Enum icu::datetime::neo_skeleton::NeoDateComponents
source · #[non_exhaustive]pub enum NeoDateComponents {
Day,
MonthDay,
YearMonthDay,
DayWeekday,
MonthDayWeekday,
YearMonthDayWeekday,
Weekday,
}
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”.
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”.
Weekday
The day of the week alone, as in “Saturday”.
Implementations§
source§impl NeoDateComponents
impl NeoDateComponents
sourcepub const VALUES: &'static [NeoDateComponents] = _
pub const VALUES: &'static [NeoDateComponents] = _
All values of this enum.
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
* g
represents a different field, but it is never used in skeleta.
§Examples
use icu::datetime::neo_skeleton::NeoDateComponents;
assert_eq!(
"ym0de",
NeoDateComponents::YearMonthDayWeekday.id_str().as_str()
);
sourcepub fn from_id_str(id_str: &DataMarkerAttributes) -> Option<NeoDateComponents>
pub fn from_id_str(id_str: &DataMarkerAttributes) -> Option<NeoDateComponents>
Returns the set of components for the given stable string.
§Examples
use icu::datetime::neo_skeleton::NeoDateComponents;
use icu_provider::prelude::*;
assert_eq!(
NeoDateComponents::from_id_str(
DataMarkerAttributes::from_str_or_panic("ym0de")
),
Some(NeoDateComponents::YearMonthDayWeekday)
);
sourcepub fn has_weekday(self) -> bool
pub fn has_weekday(self) -> bool
Whether this field set contains the weekday.
sourcepub fn long(self) -> NeoDateSkeleton
pub fn long(self) -> NeoDateSkeleton
Creates a skeleton for this field set with a long length.
sourcepub fn medium(self) -> NeoDateSkeleton
pub fn medium(self) -> NeoDateSkeleton
Creates a skeleton for this field set with a medium length.
sourcepub fn short(self) -> NeoDateSkeleton
pub fn short(self) -> NeoDateSkeleton
Creates a skeleton for this field set with a short length.
Trait Implementations§
source§impl Clone for NeoDateComponents
impl Clone for NeoDateComponents
source§fn clone(&self) -> NeoDateComponents
fn clone(&self) -> NeoDateComponents
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for NeoDateComponents
impl Debug for NeoDateComponents
source§impl From<NeoDateComponents> for NeoComponents
impl From<NeoDateComponents> for NeoComponents
source§fn from(value: NeoDateComponents) -> NeoComponents
fn from(value: NeoDateComponents) -> NeoComponents
source§impl From<NeoDateComponents> for NeoDateTimeComponents
impl From<NeoDateComponents> for NeoDateTimeComponents
source§fn from(value: NeoDateComponents) -> NeoDateTimeComponents
fn from(value: NeoDateComponents) -> NeoDateTimeComponents
source§impl Hash for NeoDateComponents
impl Hash for NeoDateComponents
source§impl PartialEq for NeoDateComponents
impl PartialEq for NeoDateComponents
impl Copy for NeoDateComponents
impl Eq for NeoDateComponents
impl StructuralPartialEq for NeoDateComponents
Auto Trait Implementations§
impl Freeze for NeoDateComponents
impl RefUnwindSafe for NeoDateComponents
impl Send for NeoDateComponents
impl Sync for NeoDateComponents
impl Unpin for NeoDateComponents
impl UnwindSafe for NeoDateComponents
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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