#[non_exhaustive]pub struct Year {
pub padding: Padding,
pub repr: YearRepr,
pub range: YearRange,
pub iso_week_based: bool,
pub sign_is_mandatory: bool,
}Year* components insteadformatting or parsing only.Expand description
Year of the date.
Fields (Non-exhaustive)ยง
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.padding: PaddingYear* components insteadThe padding to obtain the minimum width.
repr: YearReprYear* components insteadWhat kind of representation should be used?
range: YearRangeYear* components insteadWhat range of years is supported?
iso_week_based: boolYear* components insteadWhether the value is based on the ISO week number or the Gregorian calendar.
sign_is_mandatory: boolYear* components insteadWhether the + sign is present when a non-negative year contains fewer digits than
necessary.
Implementationsยง
Sourceยงimpl Year
impl Year
Sourcepub const fn default() -> Self
pub const fn default() -> Self
Creates a modifier that indicates the value uses the Full
representation, is padded with zeroes, uses the Gregorian calendar as its
base, and only includes the yearโs sign if necessary.
This function exists since Default::default() cannot be used in a const context.
It may be removed once that becomes possible. As the Default trait is in the
prelude, removing this function in the future will not cause any resolution failures for
the overwhelming majority of users; only users who use #![no_implicit_prelude] will be
affected. As such it will not be considered a breaking change.
Sourceยงimpl Year
impl Year
Sourcepub const fn with_padding(self, padding: Padding) -> Self
pub const fn with_padding(self, padding: Padding) -> Self
Set the padding type.
Sourcepub const fn with_repr(self, repr: YearRepr) -> Self
pub const fn with_repr(self, repr: YearRepr) -> Self
Set the manner in which the year is represented.
Sourcepub const fn with_range(self, range: YearRange) -> Self
pub const fn with_range(self, range: YearRange) -> Self
Set the range of years that are supported.
Sourcepub const fn with_iso_week_based(self, iso_week_based: bool) -> Self
pub const fn with_iso_week_based(self, iso_week_based: bool) -> Self
Set whether the year is based on the ISO week number.
Sourcepub const fn with_sign_is_mandatory(self, sign_is_mandatory: bool) -> Self
pub const fn with_sign_is_mandatory(self, sign_is_mandatory: bool) -> Self
Set whether the + sign is mandatory for positive years with fewer than five digits.
Trait Implementationsยง
Sourceยงimpl Default for Year
Creates a modifier that indicates the value uses the Full
representation, is padded with zeroes, uses the Gregorian calendar as its
base, and only includes the yearโs sign if necessary.
impl Default for Year
Creates a modifier that indicates the value uses the Full
representation, is padded with zeroes, uses the Gregorian calendar as its
base, and only includes the yearโs sign if necessary.
Sourceยงimpl Eq for Year
impl Eq for Year
Sourceยง#[doc(hidden)]fn assert_fields_are_eq(&self)
#[doc(hidden)]fn assert_fields_are_eq(&self)
derive_eq_internals)1.0.0 ยท Sourceยง#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
#[derive(Eq)]impl Copy for Year
impl StructuralPartialEq for Year
impl TrivialClone for Year
Auto Trait Implementationsยง
impl Freeze for Year
impl RefUnwindSafe for Year
impl Send for Year
impl Sync for Year
impl Unpin for Year
impl UnsafeUnpin for Year
impl UnwindSafe for Year
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ยงimpl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Sourceยง#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
sized_type_properties)Sourceยง#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
sized_type_properties)Sourceยง#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)Sourceยง#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
sized_type_properties)Sourceยง#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
sized_type_properties)Sourceยง#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read more