Trait std::convert::From 1.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);
Generic impls
Required Methods
fn from(T) -> Self
Performs the conversion.
Implementors
impl<T> From<T> for std::boxed::Box<T>
impl<T> From<T> for Arc<T>
impl<T> From<T> for Rc<T>
impl<T> From<T> for T
impl<T> From<T> for Cell<T> where T: Copy
impl<T> From<T> for RefCell<T>
impl<T> From<T> for UnsafeCell<T>
impl From<char> for u32
impl From<u8> for char
impl<T> From<T> for Option<T>
impl From<u8> for u16
impl From<u8> for u32
impl From<u8> for u64
impl From<u8> for u128
impl From<u8> for usize
impl From<u16> for u32
impl From<u16> for u64
impl From<u16> for u128
impl From<u32> for u64
impl From<u32> for u128
impl From<u64> for u128
impl From<i8> for i16
impl From<i8> for i32
impl From<i8> for i64
impl From<i8> for i128
impl From<i8> for isize
impl From<i16> for i32
impl From<i16> for i64
impl From<i16> for i128
impl From<i32> for i64
impl From<i32> for i128
impl From<i64> for i128
impl From<u8> for i16
impl From<u8> for i32
impl From<u8> for i64
impl From<u8> for i128
impl From<u16> for i32
impl From<u16> for i64
impl From<u16> for i128
impl From<u32> for i64
impl From<u32> for i128
impl From<u64> for i128
impl From<i8> for f32
impl From<i8> for f64
impl From<i16> for f32
impl From<i16> for f64
impl From<i32> for f64
impl From<u8> for f32
impl From<u8> for f64
impl From<u16> for f32
impl From<u16> for f64
impl From<u32> for f64
impl From<f32> for f64
impl<T> From<Vec<T>> for BinaryHeap<T> where T: Ord
impl<T> From<BinaryHeap<T>> for std::vec::Vec<T>
impl<'a> From<&'a str> for std::string::String
impl<'a> From<Cow<'a, str>> for std::string::String
impl<'a> From<&'a str> for std::borrow::Cow<'a, str>
impl<'a> From<String> for std::borrow::Cow<'a, str>
impl From<String> for std::vec::Vec<u8>
impl<'a, T> From<&'a [T]> for std::vec::Vec<T> where T: Clone
impl<'a, T> From<Cow<'a, [T]>> for std::vec::Vec<T> where [T]: ToOwned,
[T]::Owned == Vec<T>impl<'a> From<&'a str> for std::vec::Vec<u8>
impl<'a, T> From<&'a [T]> for std::borrow::Cow<'a, [T]> where T: Clone
impl<'a, T> From<Vec<T>> for std::borrow::Cow<'a, [T]> where T: Clone
impl<T> From<Vec<T>> for VecDeque<T>
impl<T> From<VecDeque<T>> for std::vec::Vec<T>
impl From<ErrorKind> for std::io::Error
impl<'a, E: Error + 'a> From<E> for std::boxed::Box<Error + 'a>
impl<'a, E: Error + Send + Sync + 'a> From<E> for std::boxed::Box<Error + Send + Sync + 'a>
impl From<String> for std::boxed::Box<Error + Send + Sync>
impl From<String> for std::boxed::Box<Error>
impl<'a, 'b> From<&'b str> for std::boxed::Box<Error + Send + Sync + 'a>
impl<'a> From<&'a str> for std::boxed::Box<Error>
impl From<CString> for std::vec::Vec<u8>
impl From<NulError> for std::io::Error
impl<'a> From<&'a CStr> for CString
impl From<String> for std::ffi::OsString
impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for std::ffi::OsString
impl<'a, T: ?Sized + AsRef<OsStr>> From<&'a T> for std::path::PathBuf
impl From<OsString> for std::path::PathBuf
impl From<PathBuf> for std::ffi::OsString
impl From<String> for std::path::PathBuf
impl<'a> From<&'a Path> for std::borrow::Cow<'a, Path>
impl<'a> From<PathBuf> for std::borrow::Cow<'a, Path>