pub struct Date(/* private fields */);Implementations§
Source§impl Date
impl Date
Sourcepub fn try_new(y: i32, m: u8, d: u8) -> Option<Self>
pub fn try_new(y: i32, m: u8, d: u8) -> Option<Self>
Build a date from exact calendar parts.
Returns None when any component is out of range.
Sourcepub const fn try_from_days_since_epoch(days: i32) -> Option<Self>
pub const fn try_from_days_since_epoch(days: i32) -> Option<Self>
Construct from the bounded internal day-count representation.
Sourcepub const fn as_days_since_epoch(self) -> i32
pub const fn as_days_since_epoch(self) -> i32
Return the internal day-count representation.
Sourcepub fn try_from_i64(days: i64) -> Option<Self>
pub fn try_from_i64(days: i64) -> Option<Self>
Fallible conversion from i64 day-count representation.
Sourcepub fn try_from_u64(days: u64) -> Option<Self>
pub fn try_from_u64(days: u64) -> Option<Self>
Fallible conversion from u64 day-count representation.
Sourcepub fn checked_add_days(self, days: i64) -> Option<Self>
pub fn checked_add_days(self, days: i64) -> Option<Self>
Add a signed number of days without leaving the supported calendar.
Sourcepub fn checked_sub_days(self, days: i64) -> Option<Self>
pub fn checked_sub_days(self, days: i64) -> Option<Self>
Subtract a signed number of days without leaving the supported calendar.
Sourcepub fn days_since(self, earlier: Self) -> i64
pub fn days_since(self, earlier: Self) -> i64
Return the signed number of days from earlier to this date.
Trait Implementations§
Source§impl CandidType for Date
impl CandidType for Date
impl Copy for Date
Source§impl<'de> Deserialize<'de> for Date
impl<'de> Deserialize<'de> for Date
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Date
Source§impl NumericValue for Date
impl NumericValue for Date
Source§fn try_to_decimal(&self) -> Option<Decimal>
fn try_to_decimal(&self) -> Option<Decimal>
Convert this value into
Decimal for generic numeric handling.Source§fn try_from_decimal(value: Decimal) -> Option<Self>
fn try_from_decimal(value: Decimal) -> Option<Self>
Rebuild the value from
Decimal after generic numeric handling.Source§impl Ord for Date
impl Ord for Date
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Date
impl PartialOrd for Date
impl StructuralPartialEq for Date
Auto Trait Implementations§
impl Freeze for Date
impl RefUnwindSafe for Date
impl Send for Date
impl Sync for Date
impl Unpin for Date
impl UnsafeUnpin for Date
impl UnwindSafe for Date
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