pub trait FromDuration<T>: Sized {
type Error;
// Required method
fn from_duration(from: T) -> Result<Self, Self::Error>;
}Expand description
A fallible conversion from one duration representation to another.
This is very similar to the std::convert::TryFrom trait which is currently
unstable.
Required Associated Types§
Required Methods§
Sourcefn from_duration(from: T) -> Result<Self, Self::Error>
fn from_duration(from: T) -> Result<Self, Self::Error>
Convert from into a Self object.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl FromDuration<FloatDuration> for Duration
impl FromDuration<FloatDuration> for Duration
type Error = OutOfRangeError
fn from_duration(from: FloatDuration) -> Result<Duration, OutOfRangeError>
Source§impl FromDuration<FloatDuration> for Duration
Available on crate feature chrono only.
impl FromDuration<FloatDuration> for Duration
Available on crate feature
chrono only.type Error = OutOfRangeError
fn from_duration(from: FloatDuration) -> Result<Duration, OutOfRangeError>
Implementors§
Source§impl FromDuration<Duration> for FloatDuration
impl FromDuration<Duration> for FloatDuration
Source§impl FromDuration<TimeDelta> for FloatDuration
Available on crate feature chrono only.
impl FromDuration<TimeDelta> for FloatDuration
Available on crate feature
chrono only.