Trait IntoDuration

Source
pub trait IntoDuration<T>: Sized {
    type Error;

    // Required method
    fn into_duration(self) -> Result<T, Self::Error>;
}
Expand description

A fallible conversion that consumes self.

This is very similar to the std::convert::TryInto trait which is currently unstable.

Similar to std::convert::Into, this trait is reflexively implemented for all implementations of FromDuration and should not be manually implemented.

Required Associated Types§

Required Methods§

Source

fn into_duration(self) -> Result<T, Self::Error>

Convert self into a T 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.

Implementors§

Source§

impl<T, U> IntoDuration<U> for T
where U: FromDuration<T>,

Source§

type Error = <U as FromDuration<T>>::Error