pub struct Duration { /* private fields */ }
Expand description
Represents a duration of time, internally stored as nanoseconds
Implementations§
Source§impl Duration
impl Duration
Sourcepub fn from_millis(millis: u64) -> TimeResult<Self>
pub fn from_millis(millis: u64) -> TimeResult<Self>
Create a new Duration
from the given number of milliseconds.
Errors with TimeError::InvalidDuration
if the number of milliseconds
would overflow when converted to nanoseconds.
Sourcepub fn from_secs(seconds: u64) -> TimeResult<Self>
pub fn from_secs(seconds: u64) -> TimeResult<Self>
Create a new Duration
from the given number of seconds.
Errors with TimeError::InvalidDuration
if the number of seconds
would overflow when converted to nanoseconds.
Trait Implementations§
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 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