pub struct Duration { /* private fields */ }Implementations§
Source§impl Duration
impl Duration
pub fn new(months: i32, days: i32, nanos: i64) -> Result<Self, Box<TypeError>>
pub fn from_seconds(seconds: i64) -> Result<Self, Box<TypeError>>
pub fn from_milliseconds(milliseconds: i64) -> Result<Self, Box<TypeError>>
pub fn from_microseconds(microseconds: i64) -> Result<Self, Box<TypeError>>
pub fn from_micros_infallible(microseconds: u64) -> Self
pub const fn from_nanoseconds_const(nanoseconds: i64) -> Self
pub const fn from_microseconds_const(microseconds: i64) -> Self
pub const fn from_milliseconds_const(milliseconds: i64) -> Self
pub const fn from_seconds_const(seconds: i64) -> Self
pub const fn from_minutes_const(minutes: i64) -> Self
pub const fn from_hours_const(hours: i64) -> Self
pub fn from_nanoseconds(nanoseconds: i64) -> Result<Self, Box<TypeError>>
pub fn from_minutes(minutes: i64) -> Result<Self, Box<TypeError>>
pub fn from_hours(hours: i64) -> Result<Self, Box<TypeError>>
pub fn from_days(days: i64) -> Result<Self, Box<TypeError>>
pub fn from_weeks(weeks: i64) -> Result<Self, Box<TypeError>>
pub fn from_months(months: i64) -> Result<Self, Box<TypeError>>
pub fn from_years(years: i64) -> Result<Self, Box<TypeError>>
pub fn zero() -> Self
pub fn seconds(&self) -> Result<i64, Box<TypeError>>
pub fn milliseconds(&self) -> Result<i64, Box<TypeError>>
pub fn microseconds(&self) -> Result<i64, Box<TypeError>>
pub fn nanoseconds(&self) -> Result<i64, Box<TypeError>>
pub fn get_months(&self) -> i32
pub fn get_days(&self) -> i32
pub fn get_nanos(&self) -> i64
pub fn as_nanos(&self) -> Result<i64, Box<TypeError>>
pub fn is_positive(&self) -> bool
pub fn is_negative(&self) -> bool
pub fn abs(&self) -> Self
pub fn negate(&self) -> Self
pub fn to_iso_string(&self) -> String
Source§impl Duration
impl Duration
pub fn try_add(self, rhs: Self) -> Result<Self, Box<TypeError>>
pub fn try_sub(self, rhs: Self) -> Result<Self, Box<TypeError>>
pub fn try_mul(self, rhs: i64) -> Result<Self, Box<TypeError>>
pub fn saturating_add(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_mul(self, rhs: i64) -> Self
Trait Implementations§
impl Copy for Duration
Source§impl<'de> Deserialize<'de> for Duration
impl<'de> Deserialize<'de> for Duration
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 Duration
Source§impl From<Duration> for Duration
impl From<Duration> for Duration
Source§fn from(duration: StdDuration) -> Self
fn from(duration: StdDuration) -> Self
Converts to this type from the input type.
Source§impl From<Duration> for IsoDuration
impl From<Duration> for IsoDuration
Source§impl From<IsoDuration> for Duration
impl From<IsoDuration> for Duration
Source§fn from(value: IsoDuration) -> Self
fn from(value: IsoDuration) -> Self
Converts to this type from the input type.
impl IsTemporal for Duration
Source§impl Ord for Duration
impl Ord for Duration
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 Duration
impl PartialOrd for Duration
impl StructuralPartialEq for Duration
Source§impl TryFromValue for Duration
impl TryFromValue for Duration
fn try_from_value(value: &Value) -> Result<Self, FromValueError>
fn from_value(value: &Value) -> Option<Self>
Source§impl TryFromValueCoerce for Duration
impl TryFromValueCoerce for Duration
fn try_from_value_coerce(value: &Value) -> Result<Self, FromValueError>
fn from_value_coerce(value: &Value) -> Option<Self>
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnsafeUnpin 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