Trait TryFrom

Source
pub trait TryFrom<T>: Sized + Sealed {
    type Error;

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

Attempt to construct Self via a conversion.

This trait will be deprecated in favor of std::convert::TryFrom once it reaches stable Rust.

Required Associated Types§

Source

type Error

The type returned in the event of a conversion error.

Required Methods§

Source

fn try_from(value: T) -> Result<Self, Self::Error>

Performs the conversion.

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> TryFrom<T> for String<T>
where T: AsRef<[u8]> + StableAsRef,