pub struct TimeDelta {
pub months: i32,
pub inner: TimeDelta,
}Fields§
§months: i32§inner: TimeDeltaImplementations§
source§impl TimeDelta
impl TimeDelta
sourcepub fn parse(duration: &str) -> Result<TimeDelta, TError>
pub fn parse(duration: &str) -> Result<TimeDelta, TError>
1ns // 1 nanosecond 1us // 1 microsecond 1ms // 1 millisecond 1s // 1 second 1m // 1 minute 1h // 1 hour 1d // 1 day 1w // 1 week 1mo // 1 calendar month 1y // 1 calendar year
Parse timedelta from string
for example: “2y1mo-3d5h-2m3s”
pub fn nat() -> TimeDelta
pub fn is_nat(&self) -> bool
pub fn is_not_nat(&self) -> bool
Trait Implementations§
source§impl IsNone for TimeDelta
impl IsNone for TimeDelta
type Inner = TimeDelta
type Cast<U: IsNone<Inner = U> + Clone> = U
fn is_none(&self) -> bool
fn none() -> Self
fn to_opt(self) -> Option<Self::Inner>
fn as_opt(&self) -> Option<&Self::Inner>
fn from_inner(inner: Self::Inner) -> Self
fn inner_cast<U: IsNone<Inner = U> + Clone>(inner: U) -> Self::Cast<U>
fn unwrap(self) -> Self::Inner
fn map<F, U: IsNone>(self, f: F) -> U
fn from_opt(opt: Option<Self::Inner>) -> Self
fn not_none(&self) -> bool
source§fn sort_cmp(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
fn sort_cmp(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
let None value be largest, only for sorting(from smallest to largest)
source§fn sort_cmp_rev(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
fn sort_cmp_rev(&self, other: &Self) -> Orderingwhere
Self::Inner: PartialOrd,
let None value be largest, only for sorting(from largest to smallest)
source§impl PartialEq for TimeDelta
impl PartialEq for TimeDelta
source§impl PartialOrd for TimeDelta
impl PartialOrd for TimeDelta
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for TimeDelta
impl Eq for TimeDelta
impl StructuralPartialEq for TimeDelta
Auto Trait Implementations§
impl Freeze for TimeDelta
impl RefUnwindSafe for TimeDelta
impl Send for TimeDelta
impl Sync for TimeDelta
impl Unpin for TimeDelta
impl UnwindSafe for TimeDelta
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)