Trait To

Source
pub trait To {
    // Provided methods
    fn to<T>(self) -> T
       where Self: Into<T> { ... }
    fn try_to<T>(self) -> Result<T, <Self as TryInto<T>>::Error>
       where Self: TryInto<T> { ... }
}
Expand description

Extension trait providing the to and try_to methods.

Provided Methods§

Source

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.

Source

fn try_to<T>(self) -> Result<T, <Self as TryInto<T>>::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.

Implementors§

Source§

impl<T: ?Sized> To for T

Blanket impl for all types. This makes sure that everything implements To and that no downstream impls can exist.