Trait core::convert::From
[−]
[src]
pub trait From<T>: Sized { fn from(T) -> Self; }
Construct Self
via a conversion.
Note: this trait must not fail. If the conversion can fail, use 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);
Generic impls
From<T> for U
impliesInto<U> for T
from()
is reflexive, which means thatFrom<T> for T
is implemented
Required Methods
fn from(T) -> Self
Performs the conversion.
Implementors
impl From for u16
impl From for u32
impl From for u64
impl From for usize
impl From for u32
impl From for u64
impl From for u64
impl From for i16
impl From for i32
impl From for i64
impl From for isize
impl From for i32
impl From for i64
impl From for i64
impl From for i16
impl From for i32
impl From for i64
impl From for i32
impl From for i64
impl From for i64
impl From for f32
impl From for f64
impl From for f32
impl From for f64
impl From for f64
impl From for f32
impl From for f64
impl From for f32
impl From for f64
impl From for f64
impl From for f64
impl<Idx: PartialOrd + One + Sub<Output=Idx>> From for RangeInclusive<Idx>