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", so this trait is not object safe.