Module icu_datetime::options::length [−][src]
Length is a model of encoding information on how to format date and time by specifying the preferred length of date and time fields.
If either of the fields is omitted, the value will be formatted according to the pattern associated with the preferred length of the present field in a given locale.
If both fields are present, both parts of the value will be formatted and an additional connector pattern
will be used to construct a full result.
The type of the connector is determined by the length of the Date
field.
Additionally, the bag contains an optional set of Preferences
which represent user preferred adjustments
that can be applied onto the pattern right before formatting.
Examples
use icu::datetime::DateTimeFormatOptions; use icu::datetime::options::length; let bag = length::Bag { date: Some(length::Date::Medium), // `Medium` length connector will be used time: Some(length::Time::Short), preferences: None, }; let options = DateTimeFormatOptions::Length(bag);
Or the options can be inferred through the Into
trait.
use icu::datetime::DateTimeFormatOptions; use icu::datetime::options::length; let options: DateTimeFormatOptions = length::Bag::default().into();
Note: The exact result returned from DateTimeFormat
is a subject to change over
time. Formatted result should be treated as opaque and displayed to the user as-is,
and it is strongly recommended to never write tests that expect a particular formatted output.
Structs
Bag | A structure to represent the set of lengths in which the |
Enums
Date | Represents different lengths a |
Time | Represents different length lengths a |