pub struct Duration { /* private fields */ }
Expand description
It stores the duration using a pair of a YearMonthDuration
and a DayTimeDuration
.
Implementations§
Source§impl Duration
impl Duration
pub const MAX: Self
pub const MIN: Self
pub fn new( months: impl Into<i64>, seconds: impl Into<Decimal>, ) -> Result<Self, OppositeSignInDurationComponentsError>
pub fn from_be_bytes(bytes: [u8; 24]) -> Self
pub fn to_be_bytes(self) -> [u8; 24]
Sourcepub fn checked_add(self, rhs: impl Into<Self>) -> Option<Self>
pub fn checked_add(self, rhs: impl Into<Self>) -> Option<Self>
op:add-yearMonthDurations and op:add-dayTimeDurations
Returns None
in case of overflow (FODT0002
).
Sourcepub fn checked_sub(self, rhs: impl Into<Self>) -> Option<Self>
pub fn checked_sub(self, rhs: impl Into<Self>) -> Option<Self>
op:subtract-yearMonthDurations and op:subtract-dayTimeDurations
Returns None
in case of overflow (FODT0002
).
Sourcepub fn checked_neg(self) -> Option<Self>
pub fn checked_neg(self) -> Option<Self>
Unary negation.
Returns None
in case of overflow (FODT0002
).
Sourcepub fn is_identical_with(self, other: Self) -> bool
pub fn is_identical_with(self, other: Self) -> bool
Checks if the two values are identical.
Trait Implementations§
Source§impl From<DayTimeDuration> for Duration
impl From<DayTimeDuration> for Duration
Source§fn from(value: DayTimeDuration) -> Self
fn from(value: DayTimeDuration) -> Self
Converts to this type from the input type.
Source§impl From<TimezoneOffset> for Duration
impl From<TimezoneOffset> for Duration
Source§fn from(value: TimezoneOffset) -> Self
fn from(value: TimezoneOffset) -> Self
Converts to this type from the input type.
Source§impl From<YearMonthDuration> for Duration
impl From<YearMonthDuration> for Duration
Source§fn from(value: YearMonthDuration) -> Self
fn from(value: YearMonthDuration) -> Self
Converts to this type from the input type.
Source§impl PartialEq<DayTimeDuration> for Duration
impl PartialEq<DayTimeDuration> for Duration
Source§impl PartialEq<Duration> for DayTimeDuration
impl PartialEq<Duration> for DayTimeDuration
Source§impl PartialEq<Duration> for YearMonthDuration
impl PartialEq<Duration> for YearMonthDuration
Source§impl PartialEq<YearMonthDuration> for Duration
impl PartialEq<YearMonthDuration> for Duration
Source§impl PartialOrd<DayTimeDuration> for Duration
impl PartialOrd<DayTimeDuration> for Duration
Source§impl PartialOrd<Duration> for DayTimeDuration
impl PartialOrd<Duration> for DayTimeDuration
Source§impl PartialOrd<Duration> for YearMonthDuration
impl PartialOrd<Duration> for YearMonthDuration
Source§impl PartialOrd<YearMonthDuration> for Duration
impl PartialOrd<YearMonthDuration> for Duration
Source§impl PartialOrd for Duration
impl PartialOrd for Duration
Source§impl TryFrom<Duration> for DayTimeDuration
impl TryFrom<Duration> for DayTimeDuration
Source§impl TryFrom<Duration> for Duration
impl TryFrom<Duration> for Duration
Source§type Error = DurationOverflowError
type Error = DurationOverflowError
The type returned in the event of a conversion error.
Source§impl TryFrom<Duration> for TimezoneOffset
impl TryFrom<Duration> for TimezoneOffset
Source§impl TryFrom<Duration> for YearMonthDuration
impl TryFrom<Duration> for YearMonthDuration
impl Copy for Duration
impl Eq for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
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