pub struct Context { /* private fields */ }
Expand description
Configuration that controls how values are formatted.
This configuration is created when ToDisplay::display_with_context()
is called
and propagates to all nested display implementations.
This struct is used by the Display
implementation to get the current formatting
specification.
Implementations§
Source§impl Context
impl Context
Sourcepub fn verbose(&self) -> bool
pub fn verbose(&self) -> bool
Returns whether verbose formatting is enabled.
When enabled:
Option
values show asSome(v)
orNone
instead ofv
or-
- Collections may include type information
- Additional details may be included depending on the type
Sourcepub fn max_items(&self) -> usize
pub fn max_items(&self) -> usize
Returns the maximum number of items to display for collections.
This affects the formatting of slices, vectors, maps, and similar collections. When a collection exceeds this limit, it will be truncated with “…”.
Defaults to 32 items.
Sourcepub fn is_local_time(&self) -> bool
pub fn is_local_time(&self) -> bool
Returns whether times should be displayed in local time.
Sourcepub fn is_utc_time(&self) -> bool
pub fn is_utc_time(&self) -> bool
Returns whether times should be displayed in UTC.
Sourcepub fn time_format(&self) -> &'static str
pub fn time_format(&self) -> &'static str
Returns the time format string used for formatting timestamps.
Format options:
- Default/
"SIMPLE"
:"%H:%M:%S%.6f"
(e.g., “23:59:59.123456”) "FULL"
:"%Y-%m-%dT%H:%M:%S%.6fZ%z"
(e.g., “2024-12-28T23:59:59.123456Z+0800”)- Custom format string using strftime format specifiers