#[non_exhaustive]pub struct YMDT {
pub length: Length,
pub alignment: Option<Alignment>,
pub year_style: Option<YearStyle>,
pub time_precision: Option<TimePrecision>,
}
Expand description
“5/17/24, 3:47:50 PM” ⇒ year, month, and day with time
§Examples
use icu::datetime::input::Date;
use icu::datetime::DateTimeFormatter;
use icu::datetime::fieldsets::YMDT;
use icu::locale::locale;
use icu::datetime::input::{DateTime, Time};
use writeable::assert_writeable_eq;
let fmt = DateTimeFormatter::try_new(
locale!("en").into(),
YMDT::short(),
)
.unwrap();
let dt = DateTime { date: Date::try_new_iso(2024, 5, 17).unwrap(), time: Time::try_new(15, 47, 50, 0).unwrap() };
assert_writeable_eq!(
fmt.format(&dt),
"5/17/24, 3:47:50 PM"
);
In FixedCalendarDateTimeFormatter
:
use icu::datetime::input::Date;
use icu::calendar::Gregorian;
use icu::datetime::FixedCalendarDateTimeFormatter;
use icu::datetime::fieldsets::YMDT;
use icu::locale::locale;
use icu::datetime::input::{DateTime, Time};
use writeable::assert_writeable_eq;
let fmt = FixedCalendarDateTimeFormatter::try_new(
locale!("en").into(),
YMDT::short(),
)
.unwrap();
let dt = DateTime { date: Date::try_new_gregorian(2024, 5, 17).unwrap(), time: Time::try_new(15, 47, 50, 0).unwrap() };
assert_writeable_eq!(
fmt.format(&dt),
"5/17/24, 3:47:50 PM"
);
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.length: Length
The desired length of the formatted string.
See: Length
alignment: Option<Alignment>
Whether fields should be aligned for a column-like layout.
See: Alignment
year_style: Option<YearStyle>
When to display the era field in the formatted string.
See: YearStyle
time_precision: Option<TimePrecision>
How precisely to display the time of day
See: TimePrecision
Implementations§
Source§impl YMDT
impl YMDT
Sourcepub const fn with_alignment(self, alignment: Alignment) -> Self
pub const fn with_alignment(self, alignment: Alignment) -> Self
Sets the alignment option.
Source§impl YMDT
impl YMDT
Sourcepub const fn with_year_style(self, year_style: YearStyle) -> Self
pub const fn with_year_style(self, year_style: YearStyle) -> Self
Sets the year style option.
Source§impl YMDT
impl YMDT
Sourcepub const fn with_time_precision(self, time_precision: TimePrecision) -> Self
pub const fn with_time_precision(self, time_precision: TimePrecision) -> Self
Sets the time precision option.
Sourcepub fn hm(self) -> Self
pub fn hm(self) -> Self
Sets the time precision to TimePrecision::Minute
Trait Implementations§
Source§impl DateDataMarkers for YMDT
impl DateDataMarkers for YMDT
Source§type Skel = FullDataCalMarkers
type Skel = FullDataCalMarkers
Cross-calendar data markers for date skeleta.
Source§type Year = FullDataCalMarkers
type Year = FullDataCalMarkers
Cross-calendar data markers for year names.
Source§type Month = FullDataCalMarkers
type Month = FullDataCalMarkers
Cross-calendar data markers for month names.
Source§type WeekdayNamesV1 = NeverMarker<LinearNames<'static>>
type WeekdayNamesV1 = NeverMarker<LinearNames<'static>>
Marker for loading weekday names.
Source§impl DateInputMarkers for YMDT
impl DateInputMarkers for YMDT
Source§type MonthInput = MonthInfo
type MonthInput = MonthInfo
Marker for resolving the month input field.
Source§type DayOfMonthInput = DayOfMonth
type DayOfMonthInput = DayOfMonth
Marker for resolving the day-of-month input field.
Source§type DayOfYearInput = ()
type DayOfYearInput = ()
Marker for resolving the day-of-year input field.
Source§type DayOfWeekInput = ()
type DayOfWeekInput = ()
Marker for resolving the day-of-week input field.
Source§impl DateTimeMarkers for YMDT
impl DateTimeMarkers for YMDT
Source§impl DateTimeNamesMarker for YMDT
impl DateTimeNamesMarker for YMDT
type YearNames = YearNamesV1
type MonthNames = MonthNamesV1
type WeekdayNames = ()
type DayPeriodNames = DayPeriodNamesV1
type ZoneEssentials = ()
type ZoneLocations = ()
type ZoneLocationsRoot = ()
type ZoneExemplars = ()
type ZoneExemplarsRoot = ()
type ZoneGenericLong = ()
type ZoneGenericShort = ()
type ZoneStandardLong = ()
type ZoneSpecificLong = ()
type ZoneSpecificShort = ()
type MetazoneLookup = ()
Source§impl GetField<CompositeFieldSet> for YMDT
impl GetField<CompositeFieldSet> for YMDT
Source§fn get_field(&self) -> CompositeFieldSet
fn get_field(&self) -> CompositeFieldSet
Returns the value of this trait’s field
T
.Source§impl TimeMarkers for YMDT
impl TimeMarkers for YMDT
Source§type DayPeriodNamesV1 = DayPeriodNamesV1
type DayPeriodNamesV1 = DayPeriodNamesV1
Marker for loading day period names.
Source§type TimeSkeletonPatternsV1 = TimeNeoSkeletonPatternsV1
type TimeSkeletonPatternsV1 = TimeNeoSkeletonPatternsV1
Marker for loading time skeleton patterns.
Source§type MinuteInput = Minute
type MinuteInput = Minute
Marker for resolving the day-of-week input field.
Source§type SecondInput = Second
type SecondInput = Second
Marker for resolving the day-of-year input field.
Source§type NanosecondInput = Nanosecond
type NanosecondInput = Nanosecond
Marker for resolving the any-calendar-kind input field.
Source§impl<C: CldrCalendar> TypedDateDataMarkers<C> for YMDT
impl<C: CldrCalendar> TypedDateDataMarkers<C> for YMDT
Source§type DateSkeletonPatternsV1 = <C as CldrCalendar>::SkeletaV1
type DateSkeletonPatternsV1 = <C as CldrCalendar>::SkeletaV1
Marker for loading date skeleton patterns.
Source§type YearNamesV1 = <C as CldrCalendar>::YearNamesV1
type YearNamesV1 = <C as CldrCalendar>::YearNamesV1
Marker for loading year names.
Source§type MonthNamesV1 = <C as CldrCalendar>::MonthNamesV1
type MonthNamesV1 = <C as CldrCalendar>::MonthNamesV1
Marker for loading month names.
Source§type WeekdayNamesV1 = NeverMarker<LinearNames<'static>>
type WeekdayNamesV1 = NeverMarker<LinearNames<'static>>
Marker for loading weekday names.
impl Copy for YMDT
impl Eq for YMDT
impl StructuralPartialEq for YMDT
impl UnstableSealed for YMDT
Auto Trait Implementations§
impl Freeze for YMDT
impl RefUnwindSafe for YMDT
impl Send for YMDT
impl Sync for YMDT
impl Unpin for YMDT
impl UnwindSafe for YMDT
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<M, T> DateTimeNamesFrom<M> for Twhere
M: DateTimeNamesMarker,
T: DateTimeNamesMarker,
<<T as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container: From<<<M as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container>,
<<T as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container: From<<<M as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container>,
<<T as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container: From<<<M as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container>,
<<T as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container: From<<<M as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container>,
<<T as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneLocationsRoot as NamesContainer<LocationsRootV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneLocationsRoot as NamesContainer<LocationsRootV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneExemplars as NamesContainer<ExemplarCitiesV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneExemplars as NamesContainer<ExemplarCitiesV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneExemplarsRoot as NamesContainer<ExemplarCitiesRootV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneExemplarsRoot as NamesContainer<ExemplarCitiesRootV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneStandardLong as NamesContainer<MetazoneStandardNamesLongV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneStandardLong as NamesContainer<MetazoneStandardNamesLongV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1, ()>>::Container>,
impl<M, T> DateTimeNamesFrom<M> for Twhere
M: DateTimeNamesMarker,
T: DateTimeNamesMarker,
<<T as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container: From<<<M as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container>,
<<T as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container: From<<<M as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container>,
<<T as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container: From<<<M as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container>,
<<T as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container: From<<<M as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container>,
<<T as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneLocationsRoot as NamesContainer<LocationsRootV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneLocationsRoot as NamesContainer<LocationsRootV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneExemplars as NamesContainer<ExemplarCitiesV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneExemplars as NamesContainer<ExemplarCitiesV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneExemplarsRoot as NamesContainer<ExemplarCitiesRootV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneExemplarsRoot as NamesContainer<ExemplarCitiesRootV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneStandardLong as NamesContainer<MetazoneStandardNamesLongV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneStandardLong as NamesContainer<MetazoneStandardNamesLongV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1, ()>>::Container>,
<<T as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1, ()>>::Container: From<<<M as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1, ()>>::Container>,
fn map_year_names( other: <<M as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container, ) -> <<T as DateTimeNamesMarker>::YearNames as NamesContainer<YearNamesV1, YearNameLength>>::Container
fn map_month_names( other: <<M as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container, ) -> <<T as DateTimeNamesMarker>::MonthNames as NamesContainer<MonthNamesV1, MonthNameLength>>::Container
fn map_weekday_names( other: <<M as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container, ) -> <<T as DateTimeNamesMarker>::WeekdayNames as NamesContainer<WeekdayNamesV1, WeekdayNameLength>>::Container
fn map_day_period_names( other: <<M as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container, ) -> <<T as DateTimeNamesMarker>::DayPeriodNames as NamesContainer<DayPeriodNamesV1, DayPeriodNameLength>>::Container
fn map_zone_essentials( other: <<M as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneEssentials as NamesContainer<TimeZoneEssentialsV1, ()>>::Container
fn map_zone_locations( other: <<M as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneLocations as NamesContainer<LocationsV1, ()>>::Container
fn map_zone_locations_root( other: <<M as DateTimeNamesMarker>::ZoneLocationsRoot as NamesContainer<LocationsRootV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneLocationsRoot as NamesContainer<LocationsRootV1, ()>>::Container
fn map_zone_exemplars( other: <<M as DateTimeNamesMarker>::ZoneExemplars as NamesContainer<ExemplarCitiesV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneExemplars as NamesContainer<ExemplarCitiesV1, ()>>::Container
fn map_zone_exemplars_root( other: <<M as DateTimeNamesMarker>::ZoneExemplarsRoot as NamesContainer<ExemplarCitiesRootV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneExemplarsRoot as NamesContainer<ExemplarCitiesRootV1, ()>>::Container
fn map_zone_generic_long( other: <<M as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneGenericLong as NamesContainer<MetazoneGenericNamesLongV1, ()>>::Container
fn map_zone_generic_short( other: <<M as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneGenericShort as NamesContainer<MetazoneGenericNamesShortV1, ()>>::Container
fn map_zone_standard_long( other: <<M as DateTimeNamesMarker>::ZoneStandardLong as NamesContainer<MetazoneStandardNamesLongV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneStandardLong as NamesContainer<MetazoneStandardNamesLongV1, ()>>::Container
fn map_zone_specific_long( other: <<M as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneSpecificLong as NamesContainer<MetazoneSpecificNamesLongV1, ()>>::Container
fn map_zone_specific_short( other: <<M as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::ZoneSpecificShort as NamesContainer<MetazoneSpecificNamesShortV1, ()>>::Container
fn map_metazone_lookup( other: <<M as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1, ()>>::Container, ) -> <<T as DateTimeNamesMarker>::MetazoneLookup as NamesContainer<MetazonePeriodV1, ()>>::Container
Source§impl<T> GetField<T> for Twhere
T: Copy + UnstableSealed,
impl<T> GetField<T> for Twhere
T: Copy + UnstableSealed,
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>
Converts
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>
Converts
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