1.7 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| default-text-formatter-config | api | config | 20260520 | Create the default TextFormatterConfig used by config and preset helpers. |
|
Default-text-formatter-config
Create the default TextFormatterConfig used by config builders and presets. This helper is useful when callers want the library default config value explicitly rather than relying on optional parameter defaults.
Interface
pub fn default_text_formatter_config() -> TextFormatterConfig {
output
TextFormatterConfig- Default serializable formatter config value.
Explanation
Detailed rules explaining key parameters and behaviors
- This helper returns the same baseline config value used by
text_console(...),file(...), andSinkConfig::new(...)defaults. - It is a config object, not a runtime
TextFormatter. - Call
to_formatter()when a runtime formatter is needed.
How to Use
Here are some specific examples provided.
When Need To Start From The Default Formatter Config Explicitly
When config code wants the baseline value before adjusting fields:
let base = default_text_formatter_config()
In this example, the default formatter config is available as a concrete value instead of an implicit optional argument default.
Error Case
e.g.:
-
There is no failure path for retrieving the default config value.
-
If a runtime formatter is required immediately, this helper alone is not enough because it returns config rather than a formatter object.
Notes
-
Use this helper for explicit config composition.
-
Use
text_formatter(...)when you want a runtime formatter directly.