Trait std::convert::From1.0.0 [] [src]

pub trait From<T> {
    fn from(T) -> Self;
}

Construct Self via a conversion.

Note: this trait must not fail. If the conversion can fail, use TryFrom or a dedicated method which returns an Option<T> or a Result<T, E>.

Examples

String implements From<&str>:

let string = "hello".to_string();
let other_string = String::from("hello");

assert_eq!(string, other_string);Run

Generic impls

Required Methods

Performs the conversion.

Implementors