Struct icu::datetime::pattern::TypedDateTimeNames
source · pub struct TypedDateTimeNames<C, FSet = CompositeDateTimeFieldSet>where
C: CldrCalendar,
FSet: DateTimeNamesMarker,{ /* private fields */ }
Expand description
A low-level type that formats datetime patterns with localized names. The calendar should be chosen at compile time.
📏 This item has a stack size of 328 bytes on the stable toolchain at release date.
Type parameters:
- The calendar chosen at compile time for additional type safety
- A components object type containing the fields that might be formatted
By default, the components object is set to CompositeDateTimeFieldSet
,
meaning that dates and times, but not time zones, are supported. A smaller
components object results in smaller stack size.
To support all fields including time zones, use CompositeFieldSet
.
§Examples
use icu::calendar::Gregorian;
use icu::calendar::DateTime;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::datetime::fields::FieldLength;
use icu::datetime::fields;
use icu::datetime::pattern::DateTimePattern;
use icu::locale::locale;
use writeable::assert_try_writeable_eq;
// Create an instance that can format abbreviated month, weekday, and day period names:
let mut names: TypedDateTimeNames<Gregorian> =
TypedDateTimeNames::try_new(locale!("uk").into()).unwrap();
names
.include_month_names(fields::Month::Format, FieldLength::Three)
.unwrap()
.include_weekday_names(fields::Weekday::Format, FieldLength::Three)
.unwrap()
.include_day_period_names(FieldLength::Three)
.unwrap();
// Create a pattern from a pattern string (note: K is the hour with h11 hour cycle):
let pattern_str = "E MMM d y -- K:mm a";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
// Test it:
let datetime = DateTime::try_new_gregorian(2023, 11, 20, 12, 35, 3).unwrap();
assert_try_writeable_eq!(names.with_pattern_unchecked(&pattern).format(&datetime), "пн лист. 20 2023 -- 0:35 пп");
If the correct data is not loaded, and error will occur:
use icu::calendar::Gregorian;
use icu::calendar::{Date, Time};
use icu::datetime::DateTimeWriteError;
use icu::datetime::parts;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::datetime::fields::{Field, FieldLength, FieldSymbol, Weekday};
use icu::datetime::pattern::{DateTimePattern, PatternLoadError};
use icu::datetime::fieldsets::enums::CompositeFieldSet;
use icu::locale::locale;
use icu::timezone::{TimeZoneInfo, IxdtfParser};
use icu_provider_adapters::empty::EmptyDataProvider;
use writeable::{Part, assert_try_writeable_parts_eq};
// Create an instance that can format all fields (CompositeFieldSet):
let mut names: TypedDateTimeNames<Gregorian, CompositeFieldSet> =
TypedDateTimeNames::try_new(locale!("en").into()).unwrap();
// Create a pattern from a pattern string:
let pattern_str = "'It is:' E MMM d y G 'at' h:mm:ssSSS a zzzz";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
// The pattern string contains lots of symbols including "E", "MMM", and "a",
// but we did not load any data!
let mut dtz = IxdtfParser::new().try_from_str("2023-11-20T11:35:03+00:00[Europe/London]").unwrap().to_calendar(Gregorian);
// Missing data is filled in on a best-effort basis, and an error is signaled.
assert_try_writeable_parts_eq!(
names.with_pattern_unchecked(&pattern).format(&dtz),
"It is: mon M11 20 2023 CE at 11:35:03.000 AM +0000",
Err(DateTimeWriteError::NamesNotLoaded(Field { symbol: FieldSymbol::Weekday(Weekday::Format), length: FieldLength::One })),
[
(7, 10, Part::ERROR), // mon
(7, 10, parts::WEEKDAY), // mon
(11, 14, Part::ERROR), // M11
(11, 14, parts::MONTH), // M11
(15, 17, icu::decimal::parts::INTEGER), // 20
(15, 17, parts::DAY), // 20
(18, 22, icu::decimal::parts::INTEGER), // 2023
(18, 22, parts::YEAR), // 2023
(23, 25, Part::ERROR), // CE
(23, 25, parts::ERA), // CE
(29, 31, icu::decimal::parts::INTEGER), // 11
(29, 31, parts::HOUR), // 11
(32, 34, icu::decimal::parts::INTEGER), // 35
(32, 34, parts::MINUTE), // 35
(35, 41, parts::SECOND), // 03.000
(35, 37, icu::decimal::parts::INTEGER), // 03
(37, 38, icu::decimal::parts::DECIMAL), // .
(38, 41, icu::decimal::parts::FRACTION), // 000
(42, 44, Part::ERROR), // AM
(42, 44, parts::DAY_PERIOD), // AM
(45, 50, Part::ERROR), // +0000
(45, 50, parts::TIME_ZONE_NAME), // +0000
]
);
// To make the error occur sooner, one can use an EmptyDataProvider:
let empty = EmptyDataProvider::new();
assert!(matches!(
names.load_for_pattern(&empty, &pattern),
Err(PatternLoadError::Data(_, Field { symbol: FieldSymbol::Weekday(_), .. })),
));
If the pattern contains fields inconsistent with the receiver, an error will occur:
use icu::calendar::Gregorian;
use icu::calendar::DateTime;
use icu::datetime::DateTimeWriteError;
use icu::datetime::parts;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::datetime::fields::{Field, FieldLength, FieldSymbol, Weekday};
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::fieldsets::O;
use icu::locale::locale;
use icu::timezone::TimeZoneInfo;
use writeable::{Part, assert_try_writeable_parts_eq};
// Create an instance that can format abbreviated month, weekday, and day period names:
let mut names: TypedDateTimeNames<Gregorian, O> =
TypedDateTimeNames::try_new(locale!("en").into()).unwrap();
// Create a pattern from a pattern string:
let pattern_str = "'It is:' E MMM d y G 'at' h:mm:ssSSS a zzzz";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
// The pattern string contains lots of symbols including "E", "MMM", and "a",
// but the `TypedDateTimeNames` is configured to format only time zones!
// Further, the time zone we provide doesn't contain any offset into!
// Missing data is filled in on a best-effort basis, and an error is signaled.
assert_try_writeable_parts_eq!(
names.with_pattern_unchecked(&pattern).format(&TimeZoneInfo::unknown()),
"It is: {E} {M} {d} {y} {G} at {h}:{m}:{s} {a} {z}",
Err(DateTimeWriteError::MissingInputField("iso_weekday")),
[
(7, 10, Part::ERROR), // {E}
(7, 10, parts::WEEKDAY), // {E}
(11, 14, Part::ERROR), // {M}
(11, 14, parts::MONTH), // {M}
(15, 18, Part::ERROR), // {d}
(15, 18, parts::DAY), // {d}
(19, 22, Part::ERROR), // {y}
(19, 22, parts::YEAR), // {y}
(23, 26, Part::ERROR), // {G}
(23, 26, parts::ERA), // {G}
(30, 33, Part::ERROR), // {h}
(30, 33, parts::HOUR), // {h}
(34, 37, Part::ERROR), // {m}
(34, 37, parts::MINUTE), // {m}
(38, 41, Part::ERROR), // {s}
(38, 41, parts::SECOND), // {s}
(42, 45, Part::ERROR), // {a}
(42, 45, parts::DAY_PERIOD), // {a}
(46, 49, Part::ERROR), // {z}
(46, 49, parts::TIME_ZONE_NAME), // {z}
]
);
Implementations§
source§impl<C, FSet> TypedDateTimeNames<C, FSet>where
C: CldrCalendar,
FSet: DateTimeNamesMarker,
impl<C, FSet> TypedDateTimeNames<C, FSet>where
C: CldrCalendar,
FSet: DateTimeNamesMarker,
sourcepub fn try_new(
prefs: DateTimeFormatterPreferences,
) -> Result<TypedDateTimeNames<C, FSet>, DataError>
pub fn try_new( prefs: DateTimeFormatterPreferences, ) -> Result<TypedDateTimeNames<C, FSet>, DataError>
Constructor that takes a selected locale and creates an empty instance.
For an example, see TypedDateTimeNames
.
✨ Enabled with the compiled_data
Cargo feature.
sourcepub fn try_new_unstable<P>(
provider: &P,
prefs: DateTimeFormatterPreferences,
) -> Result<TypedDateTimeNames<C, FSet>, DataError>
pub fn try_new_unstable<P>( provider: &P, prefs: DateTimeFormatterPreferences, ) -> Result<TypedDateTimeNames<C, FSet>, DataError>
A version of Self::try_new
that uses custom data provided by a DataProvider
.
sourcepub fn new_without_number_formatting(
prefs: DateTimeFormatterPreferences,
) -> TypedDateTimeNames<C, FSet>
pub fn new_without_number_formatting( prefs: DateTimeFormatterPreferences, ) -> TypedDateTimeNames<C, FSet>
Creates a completely empty instance, not even with number formatting.
§Examples
Errors occur if a number formatter is not loaded but one is required:
use icu::calendar::Gregorian;
use icu::calendar::Date;
use icu::datetime::parts;
use icu::datetime::DateTimeWriteError;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::datetime::fields::{Field, FieldLength, FieldSymbol, Weekday};
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::fieldsets::enums::DateFieldSet;
use icu::locale::locale;
use writeable::{Part, assert_try_writeable_parts_eq};
// Create an instance that can format only date fields:
let names: TypedDateTimeNames<Gregorian, DateFieldSet> =
TypedDateTimeNames::new_without_number_formatting(locale!("en").into());
// Create a pattern from a pattern string:
let pattern_str = "'It is:' y-MM-dd";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
// The pattern string contains lots of numeric symbols,
// but we did not load any data!
let date = Date::try_new_gregorian(2024, 7, 1).unwrap();
// Missing data is filled in on a best-effort basis, and an error is signaled.
// (note that the padding is ignored in this fallback mode)
assert_try_writeable_parts_eq!(
names.with_pattern_unchecked(&pattern).format(&date),
"It is: 2024-07-01",
Err(DateTimeWriteError::FixedDecimalFormatterNotLoaded),
[
(7, 11, Part::ERROR), // 2024
(7, 11, parts::YEAR), // 2024
(12, 14, Part::ERROR), // 07
(12, 14, parts::MONTH), // 07
(15, 17, Part::ERROR), // 01
(15, 17, parts::DAY), // 01
]
);
sourcepub fn load_year_names<P>(
&mut self,
provider: &P,
field_length: FieldLength,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn load_year_names<P>( &mut self, provider: &P, field_length: FieldLength, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Loads year (era or cycle) names for the specified length.
Does not support multiple field symbols or lengths. See #4337
sourcepub fn include_year_names(
&mut self,
field_length: FieldLength,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_year_names( &mut self, field_length: FieldLength, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes year (era or cycle) names for the specified length.
Does not support multiple field symbols or lengths. See #4337
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fields::FieldLength;
use icu::datetime::pattern::PatternLoadError;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
let mut names =
TypedDateTimeNames::<Gregorian>::try_new(locale!("und").into())
.unwrap();
// First length is successful:
names.include_year_names(FieldLength::Four).unwrap();
// Attempting to load the first length a second time will succeed:
names.include_year_names(FieldLength::Four).unwrap();
// But loading a new length fails:
assert!(matches!(
names.include_year_names(FieldLength::Three),
Err(PatternLoadError::ConflictingField(_))
));
sourcepub fn load_month_names<P>(
&mut self,
provider: &P,
field_symbol: Month,
field_length: FieldLength,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn load_month_names<P>( &mut self, provider: &P, field_symbol: Month, field_length: FieldLength, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Loads month names for the specified symbol and length.
Does not support multiple field symbols or lengths. See #4337
sourcepub fn include_month_names(
&mut self,
field_symbol: Month,
field_length: FieldLength,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_month_names( &mut self, field_symbol: Month, field_length: FieldLength, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes month names for the specified symbol and length.
Does not support multiple field symbols or lengths. See #4337
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fields::FieldLength;
use icu::datetime::pattern::PatternLoadError;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
let mut names =
TypedDateTimeNames::<Gregorian>::try_new(locale!("und").into())
.unwrap();
let field_symbol = icu::datetime::fields::Month::Format;
let alt_field_symbol = icu::datetime::fields::Month::StandAlone;
// First length is successful:
names
.include_month_names(field_symbol, FieldLength::Four)
.unwrap();
// Attempting to load the first length a second time will succeed:
names
.include_month_names(field_symbol, FieldLength::Four)
.unwrap();
// But loading a new symbol or length fails:
assert!(matches!(
names.include_month_names(alt_field_symbol, FieldLength::Four),
Err(PatternLoadError::ConflictingField(_))
));
assert!(matches!(
names.include_month_names(field_symbol, FieldLength::Three),
Err(PatternLoadError::ConflictingField(_))
));
sourcepub fn load_day_period_names<P>(
&mut self,
provider: &P,
field_length: FieldLength,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn load_day_period_names<P>( &mut self, provider: &P, field_length: FieldLength, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Loads day period names for the specified length.
Does not support multiple field symbols or lengths. See #4337
sourcepub fn include_day_period_names(
&mut self,
field_length: FieldLength,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_day_period_names( &mut self, field_length: FieldLength, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes day period names for the specified length.
Does not support multiple field symbols or lengths. See #4337
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fields::FieldLength;
use icu::datetime::pattern::PatternLoadError;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
let mut names =
TypedDateTimeNames::<Gregorian>::try_new(locale!("und").into())
.unwrap();
// First length is successful:
names.include_day_period_names(FieldLength::Four).unwrap();
// Attempting to load the first length a second time will succeed:
names.include_day_period_names(FieldLength::Four).unwrap();
// But loading a new length fails:
assert!(matches!(
names.include_day_period_names(FieldLength::Three),
Err(PatternLoadError::ConflictingField(_))
));
sourcepub fn load_weekday_names<P>(
&mut self,
provider: &P,
field_symbol: Weekday,
field_length: FieldLength,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn load_weekday_names<P>( &mut self, provider: &P, field_symbol: Weekday, field_length: FieldLength, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Loads weekday names for the specified symbol and length.
Does not support multiple field symbols or lengths. See #4337
sourcepub fn include_weekday_names(
&mut self,
field_symbol: Weekday,
field_length: FieldLength,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_weekday_names( &mut self, field_symbol: Weekday, field_length: FieldLength, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes weekday names for the specified symbol and length.
Does not support multiple field symbols or lengths. See #4337
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fields::FieldLength;
use icu::datetime::pattern::PatternLoadError;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
let mut names =
TypedDateTimeNames::<Gregorian>::try_new(locale!("und").into())
.unwrap();
let field_symbol = icu::datetime::fields::Weekday::Format;
let alt_field_symbol = icu::datetime::fields::Weekday::StandAlone;
// First length is successful:
names
.include_weekday_names(field_symbol, FieldLength::Four)
.unwrap();
// Attempting to load the first length a second time will succeed:
names
.include_weekday_names(field_symbol, FieldLength::Four)
.unwrap();
// But loading a new symbol or length fails:
assert!(matches!(
names.include_weekday_names(alt_field_symbol, FieldLength::Four),
Err(PatternLoadError::ConflictingField(_))
));
assert!(matches!(
names.include_weekday_names(field_symbol, FieldLength::Three),
Err(PatternLoadError::ConflictingField(_))
));
sourcepub fn load_time_zone_essentials<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn load_time_zone_essentials<P>( &mut self, provider: &P, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Loads shared essential patterns for time zone formatting.
sourcepub fn include_time_zone_essentials(
&mut self,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_time_zone_essentials( &mut self, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes shared essential patterns for time zone formatting.
This data should always be loaded when performing time zone formatting. By itself, it allows localized offset formats.
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fieldsets::enums::ZoneFieldSet;
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
use icu::timezone::IxdtfParser;
use writeable::assert_try_writeable_eq;
let mut zone_london_winter = IxdtfParser::new()
.try_from_str("2024-01-01T00:00:00+00:00[Europe/London]")
.unwrap()
.zone;
let mut zone_london_summer = IxdtfParser::new()
.try_from_str("2024-07-01T00:00:00+01:00[Europe/London]")
.unwrap()
.zone;
let mut names = TypedDateTimeNames::<Gregorian, ZoneFieldSet>::try_new(
locale!("en-GB").into(),
)
.unwrap();
names.include_time_zone_essentials().unwrap();
// Create a pattern with symbol `OOOO`:
let pattern_str = "'Your time zone is:' OOOO";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: GMT",
);
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_summer),
"Your time zone is: GMT+01:00",
);
// Now try `V`:
let pattern_str = "'Your time zone is:' V";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: gblon",
);
// Now try `Z`:
let pattern_str = "'Your time zone is:' Z";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: +0000",
);
// Now try `ZZZZZ`:
let pattern_str = "'Your time zone is:' ZZZZZ";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: Z",
);
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_summer),
"Your time zone is: +01:00",
);
sourcepub fn load_time_zone_location_names<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn load_time_zone_location_names<P>( &mut self, provider: &P, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Loads location names for time zone formatting.
sourcepub fn include_time_zone_location_names(
&mut self,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_time_zone_location_names( &mut self, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes location names for time zone formatting.
Important: When performing manual time zone data loading, in addition to the specific time zone format data, also call either:
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fieldsets::enums::ZoneFieldSet;
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
use icu::timezone::IxdtfParser;
use writeable::assert_try_writeable_eq;
let mut zone_london_winter = IxdtfParser::new()
.try_from_str("2024-01-01T00:00:00+00:00[Europe/London]")
.unwrap()
.zone;
let mut names = TypedDateTimeNames::<Gregorian, ZoneFieldSet>::try_new(
locale!("en-GB").into(),
)
.unwrap();
names.include_time_zone_essentials().unwrap();
names.include_time_zone_location_names().unwrap();
// Try `VVVV`:
let pattern_str = "'Your time zone is:' VVVV";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: UK Time",
);
sourcepub fn load_time_zone_generic_long_names<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>where
P: DataProvider<MetazoneGenericNamesLongV1Marker> + DataProvider<MetazonePeriodV1Marker> + ?Sized,
pub fn load_time_zone_generic_long_names<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>where
P: DataProvider<MetazoneGenericNamesLongV1Marker> + DataProvider<MetazonePeriodV1Marker> + ?Sized,
Loads generic non-location long time zone names.
sourcepub fn include_time_zone_generic_long_names(
&mut self,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_time_zone_generic_long_names( &mut self, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes generic non-location long time zone names.
Important: When performing manual time zone data loading, in addition to the specific time zone format data, also call either:
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fieldsets::enums::ZoneFieldSet;
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
use icu::timezone::IxdtfParser;
use writeable::assert_try_writeable_eq;
let mut zone_london_winter = IxdtfParser::new()
.try_from_str("2024-01-01T00:00:00+00:00[Europe/London]")
.unwrap()
.zone;
let mut zone_london_summer = IxdtfParser::new()
.try_from_str("2024-07-01T00:00:00+01:00[Europe/London]")
.unwrap()
.zone;
let mut names = TypedDateTimeNames::<Gregorian, ZoneFieldSet>::try_new(
locale!("en-GB").into(),
)
.unwrap();
names.include_time_zone_essentials().unwrap();
names.include_time_zone_generic_long_names().unwrap();
// Create a pattern with symbol `vvvv`:
let pattern_str = "'Your time zone is:' vvvv";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: Greenwich Mean Time",
);
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_summer),
"Your time zone is: Greenwich Mean Time", // TODO
);
sourcepub fn load_time_zone_generic_short_names<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>where
P: DataProvider<MetazoneGenericNamesShortV1Marker> + DataProvider<MetazonePeriodV1Marker> + ?Sized,
pub fn load_time_zone_generic_short_names<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>where
P: DataProvider<MetazoneGenericNamesShortV1Marker> + DataProvider<MetazonePeriodV1Marker> + ?Sized,
Loads generic non-location short time zone names.
sourcepub fn include_time_zone_generic_short_names(
&mut self,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_time_zone_generic_short_names( &mut self, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes generic non-location short time zone names.
Important: When performing manual time zone data loading, in addition to the specific time zone format data, also call either:
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fieldsets::enums::ZoneFieldSet;
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
use icu::timezone::IxdtfParser;
use writeable::assert_try_writeable_eq;
let mut zone_london_winter = IxdtfParser::new()
.try_from_str("2024-01-01T00:00:00+00:00[Europe/London]")
.unwrap()
.zone;
let mut zone_london_summer = IxdtfParser::new()
.try_from_str("2024-07-01T00:00:00+01:00[Europe/London]")
.unwrap()
.zone;
let mut names = TypedDateTimeNames::<Gregorian, ZoneFieldSet>::try_new(
locale!("en-GB").into(),
)
.unwrap();
names.include_time_zone_essentials().unwrap();
names.include_time_zone_generic_short_names().unwrap();
// Create a pattern with symbol `v`:
let pattern_str = "'Your time zone is:' v";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: GMT",
);
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_summer),
"Your time zone is: GMT", // TODO
);
sourcepub fn load_time_zone_specific_long_names<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>where
P: DataProvider<MetazoneSpecificNamesLongV1Marker> + DataProvider<MetazonePeriodV1Marker> + ?Sized,
pub fn load_time_zone_specific_long_names<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>where
P: DataProvider<MetazoneSpecificNamesLongV1Marker> + DataProvider<MetazonePeriodV1Marker> + ?Sized,
Loads specific non-location long time zone names.
sourcepub fn include_time_zone_specific_long_names(
&mut self,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_time_zone_specific_long_names( &mut self, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes specific non-location long time zone names.
Important: When performing manual time zone data loading, in addition to the specific time zone format data, also call either:
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fieldsets::enums::ZoneFieldSet;
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
use icu::timezone::IxdtfParser;
use writeable::assert_try_writeable_eq;
let mut zone_london_winter = IxdtfParser::new()
.try_from_str("2024-01-01T00:00:00+00:00[Europe/London]")
.unwrap()
.zone;
let mut zone_london_summer = IxdtfParser::new()
.try_from_str("2024-07-01T00:00:00+01:00[Europe/London]")
.unwrap()
.zone;
let mut names = TypedDateTimeNames::<Gregorian, ZoneFieldSet>::try_new(
locale!("en-GB").into(),
)
.unwrap();
names.include_time_zone_essentials().unwrap();
names.include_time_zone_specific_long_names().unwrap();
// Create a pattern with symbol `zzzz`:
let pattern_str = "'Your time zone is:' zzzz";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: Greenwich Mean Time",
);
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_summer),
"Your time zone is: British Summer Time",
);
sourcepub fn load_time_zone_specific_short_names<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn load_time_zone_specific_short_names<P>( &mut self, provider: &P, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Loads specific non-location short time zone names.
sourcepub fn include_time_zone_specific_short_names(
&mut self,
) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
pub fn include_time_zone_specific_short_names( &mut self, ) -> Result<&mut TypedDateTimeNames<C, FSet>, PatternLoadError>
Includes specific non-location short time zone names.
Important: When performing manual time zone data loading, in addition to the specific time zone format data, also call either:
§Examples
use icu::calendar::Gregorian;
use icu::datetime::fieldsets::enums::ZoneFieldSet;
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
use icu::timezone::IxdtfParser;
use writeable::assert_try_writeable_eq;
let mut zone_london_winter = IxdtfParser::new()
.try_from_str("2024-01-01T00:00:00+00:00[Europe/London]")
.unwrap()
.zone;
let mut zone_london_summer = IxdtfParser::new()
.try_from_str("2024-07-01T00:00:00+01:00[Europe/London]")
.unwrap()
.zone;
let mut names = TypedDateTimeNames::<Gregorian, ZoneFieldSet>::try_new(
locale!("en-GB").into(),
)
.unwrap();
names.include_time_zone_essentials().unwrap();
names.include_time_zone_specific_short_names().unwrap();
// Create a pattern with symbol `z`:
let pattern_str = "'Your time zone is:' z";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_winter),
"Your time zone is: GMT",
);
assert_try_writeable_eq!(
names
.with_pattern_unchecked(&pattern)
.format(&zone_london_summer),
"Your time zone is: BST",
);
sourcepub fn load_fixed_decimal_formatter<P>(
&mut self,
provider: &P,
) -> Result<&mut TypedDateTimeNames<C, FSet>, DataError>
pub fn load_fixed_decimal_formatter<P>( &mut self, provider: &P, ) -> Result<&mut TypedDateTimeNames<C, FSet>, DataError>
Loads a FixedDecimalFormatter
from a data provider.
sourcepub fn include_fixed_decimal_formatter(
&mut self,
) -> Result<&mut TypedDateTimeNames<C, FSet>, DataError>
pub fn include_fixed_decimal_formatter( &mut self, ) -> Result<&mut TypedDateTimeNames<C, FSet>, DataError>
Loads a FixedDecimalFormatter
with compiled data.
§Examples
use icu::calendar::Time;
use icu::datetime::fieldsets::enums::TimeFieldSet;
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
use writeable::assert_try_writeable_eq;
let mut names =
TypedDateTimeNames::<(), TimeFieldSet>::try_new(locale!("bn").into())
.unwrap();
names.include_fixed_decimal_formatter();
// Create a pattern for the time, which is all numbers
let pattern_str = "'The current 24-hour time is:' HH:mm";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
let time = Time::try_new(6, 40, 33, 0).unwrap();
assert_try_writeable_eq!(
names.with_pattern_unchecked(&pattern).format(&time),
"The current 24-hour time is: ০৬:৪০",
);
sourcepub fn with_pattern_unchecked<'l>(
&'l self,
pattern: &'l DateTimePattern,
) -> DateTimePatternFormatter<'l, C, FSet>
pub fn with_pattern_unchecked<'l>( &'l self, pattern: &'l DateTimePattern, ) -> DateTimePatternFormatter<'l, C, FSet>
Associates this TypedDateTimeNames
with a pattern
without checking that all necessary data is loaded.
sourcepub fn load_for_pattern<'l, P>(
&'l mut self,
provider: &P,
pattern: &'l DateTimePattern,
) -> Result<DateTimePatternFormatter<'l, C, FSet>, PatternLoadError>where
P: DataProvider<<C as CldrCalendar>::YearNamesV1Marker> + DataProvider<<C as CldrCalendar>::MonthNamesV1Marker> + DataProvider<WeekdayNamesV1Marker> + DataProvider<DayPeriodNamesV1Marker> + DataProvider<TimeZoneEssentialsV1Marker> + DataProvider<LocationsV1Marker> + DataProvider<MetazoneGenericNamesLongV1Marker> + DataProvider<MetazoneGenericNamesShortV1Marker> + DataProvider<MetazoneSpecificNamesLongV1Marker> + DataProvider<MetazoneSpecificNamesShortV1Marker> + DataProvider<MetazonePeriodV1Marker> + DataProvider<DecimalSymbolsV2Marker> + DataProvider<DecimalDigitsV1Marker> + ?Sized,
pub fn load_for_pattern<'l, P>(
&'l mut self,
provider: &P,
pattern: &'l DateTimePattern,
) -> Result<DateTimePatternFormatter<'l, C, FSet>, PatternLoadError>where
P: DataProvider<<C as CldrCalendar>::YearNamesV1Marker> + DataProvider<<C as CldrCalendar>::MonthNamesV1Marker> + DataProvider<WeekdayNamesV1Marker> + DataProvider<DayPeriodNamesV1Marker> + DataProvider<TimeZoneEssentialsV1Marker> + DataProvider<LocationsV1Marker> + DataProvider<MetazoneGenericNamesLongV1Marker> + DataProvider<MetazoneGenericNamesShortV1Marker> + DataProvider<MetazoneSpecificNamesLongV1Marker> + DataProvider<MetazoneSpecificNamesShortV1Marker> + DataProvider<MetazonePeriodV1Marker> + DataProvider<DecimalSymbolsV2Marker> + DataProvider<DecimalDigitsV1Marker> + ?Sized,
Associates this TypedDateTimeNames
with a datetime pattern
and loads all data required for that pattern.
Does not duplicate textual field symbols. See #4337
sourcepub fn include_for_pattern<'l>(
&'l mut self,
pattern: &'l DateTimePattern,
) -> Result<DateTimePatternFormatter<'l, C, FSet>, PatternLoadError>
pub fn include_for_pattern<'l>( &'l mut self, pattern: &'l DateTimePattern, ) -> Result<DateTimePatternFormatter<'l, C, FSet>, PatternLoadError>
Associates this TypedDateTimeNames
with a pattern
and includes all data required for that pattern.
Does not support duplicate textual field symbols. See #4337
§Examples
use icu::calendar::DateTime;
use icu::calendar::Gregorian;
use icu::datetime::pattern::DateTimePattern;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::locale::locale;
use writeable::assert_try_writeable_eq;
let mut names =
TypedDateTimeNames::<Gregorian>::try_new(locale!("en").into()).unwrap();
// Create a pattern from a pattern string:
let pattern_str = "MMM d (EEEE) 'of year' y G 'at' h:mm a";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
// Load data for the pattern and format:
let datetime =
DateTime::try_new_gregorian(2023, 12, 5, 17, 43, 12).unwrap();
assert_try_writeable_eq!(
names
.include_for_pattern(&pattern)
.unwrap()
.format(&datetime),
"Dec 5 (Tuesday) of year 2023 AD at 5:43 PM"
);
sourcepub fn with_fset<FSet2>(self) -> TypedDateTimeNames<C, FSet2>where
FSet2: DateTimeNamesFrom<FSet>,
pub fn with_fset<FSet2>(self) -> TypedDateTimeNames<C, FSet2>where
FSet2: DateTimeNamesFrom<FSet>,
Maps a TypedDateTimeNames
of a specific FSet
to a more general FSet
.
For example, this can transform a formatter for DateFieldSet
to one for
CompositeDateTimeFieldSet
.
§Examples
use icu::calendar::Gregorian;
use icu::calendar::DateTime;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::datetime::fields::FieldLength;
use icu::datetime::fields;
use icu::datetime::fieldsets::enums::{DateFieldSet, CompositeDateTimeFieldSet};
use icu::datetime::pattern::DateTimePattern;
use icu::locale::locale;
use writeable::assert_try_writeable_eq;
// Create an instance that can format abbreviated month names:
let mut names: TypedDateTimeNames<Gregorian, DateFieldSet> =
TypedDateTimeNames::try_new(locale!("uk").into()).unwrap();
names
.include_month_names(fields::Month::Format, FieldLength::Three)
.unwrap();
// Test it with a pattern:
let pattern_str = "MMM d y";
let pattern: DateTimePattern = pattern_str.parse().unwrap();
let datetime = DateTime::try_new_gregorian(2023, 11, 20, 12, 35, 3).unwrap();
assert_try_writeable_eq!(names.with_pattern_unchecked(&pattern).format(&datetime), "лист. 20 2023");
// Convert the field set to `CompositeDateTimeFieldSet`:
let composite_names = names.with_fset::<CompositeDateTimeFieldSet>();
// It should still work:
assert_try_writeable_eq!(composite_names.with_pattern_unchecked(&pattern).format(&datetime), "лист. 20 2023");
Converting into a narrower type is not supported:
use icu::calendar::Gregorian;
use icu::datetime::pattern::TypedDateTimeNames;
use icu::datetime::fieldsets::enums::{DateFieldSet, CompositeDateTimeFieldSet};
let composite_names: TypedDateTimeNames<Gregorian, CompositeDateTimeFieldSet> = todo!();
// error[E0277]: the trait bound `(): From<DataPayloadWithVariables<DayPeriodNamesV1Marker, FieldLength>>` is not satisfied
let narrow_names = composite_names.with_fset::<DateFieldSet>();
Trait Implementations§
Auto Trait Implementations§
impl<C, FSet> Freeze for TypedDateTimeNames<C, FSet>where
<<FSet as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1Marker, FieldLength>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1Marker, (Month, FieldLength)>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1Marker, (Weekday, FieldLength)>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1Marker, FieldLength>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1Marker, ()>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1Marker, ()>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1Marker, ()>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1Marker, ()>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1Marker, ()>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1Marker, ()>>::Container: Freeze,
<<FSet as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1Marker, ()>>::Container: Freeze,
impl<C, FSet> RefUnwindSafe for TypedDateTimeNames<C, FSet>where
<<FSet as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1Marker, FieldLength>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1Marker, (Month, FieldLength)>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1Marker, (Weekday, FieldLength)>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1Marker, FieldLength>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1Marker, ()>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1Marker, ()>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1Marker, ()>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1Marker, ()>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1Marker, ()>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1Marker, ()>>::Container: RefUnwindSafe,
<<FSet as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1Marker, ()>>::Container: RefUnwindSafe,
C: RefUnwindSafe,
FSet: RefUnwindSafe,
impl<C, FSet> Send for TypedDateTimeNames<C, FSet>where
<<FSet as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1Marker, FieldLength>>::Container: Send,
<<FSet as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1Marker, (Month, FieldLength)>>::Container: Send,
<<FSet as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1Marker, (Weekday, FieldLength)>>::Container: Send,
<<FSet as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1Marker, FieldLength>>::Container: Send,
<<FSet as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1Marker, ()>>::Container: Send,
<<FSet as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1Marker, ()>>::Container: Send,
<<FSet as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1Marker, ()>>::Container: Send,
<<FSet as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1Marker, ()>>::Container: Send,
<<FSet as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1Marker, ()>>::Container: Send,
<<FSet as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1Marker, ()>>::Container: Send,
<<FSet as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1Marker, ()>>::Container: Send,
C: Send,
FSet: Send,
impl<C, FSet> Sync for TypedDateTimeNames<C, FSet>where
<<FSet as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1Marker, FieldLength>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1Marker, (Month, FieldLength)>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1Marker, (Weekday, FieldLength)>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1Marker, FieldLength>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1Marker, ()>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1Marker, ()>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1Marker, ()>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1Marker, ()>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1Marker, ()>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1Marker, ()>>::Container: Sync,
<<FSet as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1Marker, ()>>::Container: Sync,
C: Sync,
FSet: Sync,
impl<C, FSet> Unpin for TypedDateTimeNames<C, FSet>where
<<FSet as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1Marker, FieldLength>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1Marker, (Month, FieldLength)>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1Marker, (Weekday, FieldLength)>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1Marker, FieldLength>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1Marker, ()>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1Marker, ()>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1Marker, ()>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1Marker, ()>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1Marker, ()>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1Marker, ()>>::Container: Unpin,
<<FSet as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1Marker, ()>>::Container: Unpin,
C: Unpin,
FSet: Unpin,
impl<C, FSet> UnwindSafe for TypedDateTimeNames<C, FSet>where
<<FSet as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1Marker, FieldLength>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1Marker, (Month, FieldLength)>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1Marker, (Weekday, FieldLength)>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1Marker, FieldLength>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1Marker, ()>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1Marker, ()>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1Marker, ()>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1Marker, ()>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1Marker, ()>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1Marker, ()>>::Container: UnwindSafe,
<<FSet as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1Marker, ()>>::Container: UnwindSafe,
C: UnwindSafe,
FSet: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more