#[non_exhaustive]pub enum NeoDayComponents {
Day,
MonthDay,
YearMonthDay,
EraYearMonthDay,
DayWeekday,
MonthDayWeekday,
YearMonthDayWeekday,
EraYearMonthDayWeekday,
Weekday,
Auto,
AutoWeekday,
}
Expand description
A specification for a set of parts of a date that specifies a single day (as opposed to a whole month or a week). Only sets that yield “sensible” dates are allowed: this type cannot describe a date such as “some Tuesday in 2023”.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Day
The day of the month, as in “on the 1st”.
MonthDay
The month and day of the month, as in “January 1st”.
YearMonthDay
The year, month, and day of the month, as in “January 1st, 2000”.
EraYearMonthDay
The era, year, month, and day of the month, as in “January 1st, 2000 A.D.”.
DayWeekday
The day of the month and day of the week, as in “Saturday 1st”.
MonthDayWeekday
The month, day of the month, and day of the week, as in “Saturday, January 1st”.
YearMonthDayWeekday
The year, month, day of the month, and day of the week, as in “Saturday, January 1st, 2000”.
EraYearMonthDayWeekday
The era, year, month, day of the month, and day of the week, as in “Saturday, January 1st, 2000 A.D.”.
Weekday
The day of the week alone, as in “Saturday”.
Auto
Fields to represent the day chosen by locale.
These are the standard date patterns for types “long”, “medium”, and
“short” as defined in UTS 35. For “full”, use
AutoWeekday
.
This is often, but not always, the same as
YearMonthDay
.
AutoWeekday
Fields to represent the day chosen by locale, hinting to also include a weekday field.
This is the standard date pattern for type “full”, extended with skeleton data in the short and medium forms.
This is often, but not always, the same as
YearMonthDayWeekday
.
Implementations§
source§impl NeoDayComponents
impl NeoDayComponents
sourcepub const fn id_str(self) -> &'static DataMarkerAttributes
pub const fn id_str(self) -> &'static DataMarkerAttributes
Returns a stable string identifying this set of components.
§Encoding Details
The string is based roughly on the UTS 35 symbol table with the following exceptions:
- Lowercase letters are chosen where there is no ambiguity:
G
becomesg
* - Capitals are replaced with their lowercase and a number 0:
M
becomesm0
- A single symbol is included for each component: length doesn’t matter
- The “auto” style is represented as
a1
* g
represents a different field, but it is never used in skeleta.
§Examples
use icu::datetime::neo_skeleton::NeoDayComponents;
assert_eq!(
"gym0de",
NeoDayComponents::EraYearMonthDayWeekday.id_str().as_str()
);
sourcepub fn from_id_str(id_str: &DataMarkerAttributes) -> Option<Self>
pub fn from_id_str(id_str: &DataMarkerAttributes) -> Option<Self>
Returns the set of components for the given stable string.
§Examples
use icu::datetime::neo_skeleton::NeoDayComponents;
use icu_provider::prelude::*;
assert_eq!(
NeoDayComponents::from_id_str(DataMarkerAttributes::from_str_or_panic("gym0de")),
Some(NeoDayComponents::EraYearMonthDayWeekday)
);
sourcepub fn has_full_year(self) -> bool
pub fn has_full_year(self) -> bool
Whether this field set contains the full year / eras.
sourcepub fn has_weekday(self) -> bool
pub fn has_weekday(self) -> bool
Whether this field set contains the weekday.
Trait Implementations§
source§impl Clone for NeoDayComponents
impl Clone for NeoDayComponents
source§fn clone(&self) -> NeoDayComponents
fn clone(&self) -> NeoDayComponents
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for NeoDayComponents
impl Debug for NeoDayComponents
source§impl Hash for NeoDayComponents
impl Hash for NeoDayComponents
source§impl PartialEq for NeoDayComponents
impl PartialEq for NeoDayComponents
source§fn eq(&self, other: &NeoDayComponents) -> bool
fn eq(&self, other: &NeoDayComponents) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for NeoDayComponents
impl Eq for NeoDayComponents
impl StructuralPartialEq for NeoDayComponents
Auto Trait Implementations§
impl Freeze for NeoDayComponents
impl RefUnwindSafe for NeoDayComponents
impl Send for NeoDayComponents
impl Sync for NeoDayComponents
impl Unpin for NeoDayComponents
impl UnwindSafe for NeoDayComponents
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