pub trait From<T> {
fn from(T) -> Self;
}Expand description
Used to do value-to-value conversions while consuming the input value. It is the reciprocal of
Into.
One should always prefer implementing From over Into
because implementing From automatically provides one with an implementation of Into
thanks to the blanket implementation in the standard library.
Only implement Into when targeting a version prior to Rust 1.41 and converting to a type
outside the current crate.
From was not able to do these types of conversions in earlier versions because of Rust’s
orphaning rules.
See Into for more details.
Prefer using Into over using From when specifying trait bounds on a generic function.
This way, types that directly implement Into can be used as arguments as well.
The From is also very useful when performing error handling. When constructing a function
that is capable of failing, the return type will generally be of the form Result<T, E>.
The From trait simplifies error handling by allowing a function to return a single error type
that encapsulate multiple error types. See the “Examples” section and the book for more
details.
Note: This trait must not fail. The From trait is intended for perfect conversions.
If the conversion can fail or is not perfect, use TryFrom.
Generic Implementations
From<T> for UimpliesInto<U> for TFromis reflexive, which means thatFrom<T> for Tis implemented
Examples
String implements From<&str>:
An explicit conversion from a &str to a String is done as follows:
let string = "hello".to_string();
let other_string = String::from("hello");
assert_eq!(string, other_string);RunWhile performing error handling it is often useful to implement From for your own error type.
By converting underlying error types to our own custom error type that encapsulates the
underlying error type, we can return a single error type without losing information on the
underlying cause. The ‘?’ operator automatically converts the underlying error type to our
custom error type by calling Into<CliError>::into which is automatically provided when
implementing From. The compiler then infers which implementation of Into should be used.
use std::fs;
use std::io;
use std::num;
enum CliError {
IoError(io::Error),
ParseError(num::ParseIntError),
}
impl From<io::Error> for CliError {
fn from(error: io::Error) -> Self {
CliError::IoError(error)
}
}
impl From<num::ParseIntError> for CliError {
fn from(error: num::ParseIntError) -> Self {
CliError::ParseError(error)
}
}
fn open_and_parse_file(file_name: &str) -> Result<i32, CliError> {
let mut contents = fs::read_to_string(&file_name)?;
let num: i32 = contents.trim().parse()?;
Ok(num)
}RunRequired Methods
Implementations on Foreign Types
Implementors
impl From<&'_ str> for Box<dyn Error>
1.6.0 · sourceimpl From<&'_ OsStr> for Box<OsStr>
1.17.0 · sourceimpl From<&'_ OsStr> for Rc<OsStr>
1.24.0 · sourceimpl From<&'_ OsStr> for Arc<OsStr>
1.24.0 · sourceimpl From<&'_ Path> for Box<Path>
1.17.0 · sourceimpl From<&'_ Path> for Rc<Path>
1.24.0 · sourceimpl From<&'_ Path> for Arc<Path>
1.24.0 · sourceimpl From<Cow<'_, OsStr>> for Box<OsStr>
1.45.0 · sourceimpl From<Cow<'_, Path>> for Box<Path>
1.45.0 · sourceimpl From<TryReserveErrorKind> for TryReserveError
sourceimpl From<ErrorKind> for Error
1.14.0 · sourceIntended for use for errors not exposed to the user, where allocating onto the heap (for normal construction via Error::new) is too costly.
impl From<Infallible> for TryFromSliceError
1.36.0 (const: unstable) · sourceimpl From<Infallible> for TryFromIntError
1.34.0 (const: unstable) · sourceimpl From<[u8; 4]> for IpAddr
1.17.0 · sourceimpl From<[u8; 4]> for Ipv4Addr
1.9.0 · sourceimpl From<[u8; 16]> for IpAddr
1.17.0 · sourceimpl From<[u8; 16]> for Ipv6Addr
1.9.0 · sourceimpl From<[u16; 8]> for IpAddr
1.17.0 · sourceimpl From<[u16; 8]> for Ipv6Addr
1.16.0 · sourceimpl From<bool> for i8
1.28.0 (const: unstable) · sourceimpl From<bool> for i16
1.28.0 (const: unstable) · sourceimpl From<bool> for i32
1.28.0 (const: unstable) · sourceimpl From<bool> for i64
1.28.0 (const: unstable) · sourceimpl From<bool> for i128
1.28.0 (const: unstable) · sourceimpl From<bool> for isize
1.28.0 (const: unstable) · sourceimpl From<bool> for u8
1.28.0 (const: unstable) · sourceimpl From<bool> for u16
1.28.0 (const: unstable) · sourceimpl From<bool> for u32
1.28.0 (const: unstable) · sourceimpl From<bool> for u64
1.28.0 (const: unstable) · sourceimpl From<bool> for u128
1.28.0 (const: unstable) · sourceimpl From<bool> for usize
1.28.0 (const: unstable) · sourceimpl From<bool> for AtomicBool
1.24.0 (const: unstable) · sourceimpl From<char> for u32
1.13.0 (const: unstable) · sourceimpl From<char> for u64
1.51.0 (const: unstable) · sourceimpl From<char> for u128
1.51.0 (const: unstable) · sourceimpl From<char> for String
1.46.0 · sourceimpl From<f32> for f64
1.6.0 (const: unstable) · sourceimpl From<i8> for f32
1.6.0 (const: unstable) · sourceimpl From<i8> for f64
1.6.0 (const: unstable) · sourceimpl From<i8> for i16
1.5.0 (const: unstable) · sourceimpl From<i8> for i32
1.5.0 (const: unstable) · sourceimpl From<i8> for i64
1.5.0 (const: unstable) · sourceimpl From<i8> for i128
1.26.0 (const: unstable) · sourceimpl From<i8> for isize
1.5.0 (const: unstable) · sourceimpl From<i8> for AtomicI8
1.34.0 (const: unstable) · sourceimpl From<i16> for f32
1.6.0 (const: unstable) · sourceimpl From<i16> for f64
1.6.0 (const: unstable) · sourceimpl From<i16> for i32
1.5.0 (const: unstable) · sourceimpl From<i16> for i64
1.5.0 (const: unstable) · sourceimpl From<i16> for i128
1.26.0 (const: unstable) · sourceimpl From<i16> for isize
1.26.0 (const: unstable) · sourceimpl From<i16> for AtomicI16
1.34.0 (const: unstable) · sourceimpl From<i32> for f64
1.6.0 (const: unstable) · sourceimpl From<i32> for i64
1.5.0 (const: unstable) · sourceimpl From<i32> for i128
1.26.0 (const: unstable) · sourceimpl From<i32> for AtomicI32
1.34.0 (const: unstable) · sourceimpl From<i64> for i128
1.26.0 (const: unstable) · sourceimpl From<i64> for AtomicI64
1.34.0 (const: unstable) · sourceimpl From<isize> for AtomicIsize
1.23.0 (const: unstable) · sourceimpl From<!> for Infallible
1.34.0 (const: unstable) · sourceimpl From<!> for TryFromIntError
sourceimpl From<u8> for char
1.13.0 (const: unstable) · sourceMaps a byte in 0x00..=0xFF to a char whose code point has the same value, in U+0000..=U+00FF.
Unicode is designed such that this effectively decodes bytes with the character encoding that IANA calls ISO-8859-1. This encoding is compatible with ASCII.
Note that this is different from ISO/IEC 8859-1 a.k.a. ISO 8859-1 (with one less hyphen), which leaves some “blanks”, byte values that are not assigned to any character. ISO-8859-1 (the IANA one) assigns them to the C0 and C1 control codes.
Note that this is also different from Windows-1252 a.k.a. code page 1252, which is a superset ISO/IEC 8859-1 that assigns some (not all!) blanks to punctuation and various Latin characters.
To confuse things further, on the Web
ascii, iso-8859-1, and windows-1252 are all aliases
for a superset of Windows-1252 that fills the remaining blanks with corresponding
C0 and C1 control codes.
impl From<u8> for f32
1.6.0 (const: unstable) · sourceimpl From<u8> for f64
1.6.0 (const: unstable) · sourceimpl From<u8> for i16
1.5.0 (const: unstable) · sourceimpl From<u8> for i32
1.5.0 (const: unstable) · sourceimpl From<u8> for i64
1.5.0 (const: unstable) · sourceimpl From<u8> for i128
1.26.0 (const: unstable) · sourceimpl From<u8> for isize
1.26.0 (const: unstable) · sourceimpl From<u8> for u16
1.5.0 (const: unstable) · sourceimpl From<u8> for u32
1.5.0 (const: unstable) · sourceimpl From<u8> for u64
1.5.0 (const: unstable) · sourceimpl From<u8> for u128
1.26.0 (const: unstable) · sourceimpl From<u8> for usize
1.5.0 (const: unstable) · sourceimpl From<u8> for ExitCode
1.61.0 · sourceimpl From<u8> for AtomicU8
1.34.0 (const: unstable) · sourceimpl From<u16> for f32
1.6.0 (const: unstable) · sourceimpl From<u16> for f64
1.6.0 (const: unstable) · sourceimpl From<u16> for i32
1.5.0 (const: unstable) · sourceimpl From<u16> for i64
1.5.0 (const: unstable) · sourceimpl From<u16> for i128
1.26.0 (const: unstable) · sourceimpl From<u16> for u32
1.5.0 (const: unstable) · sourceimpl From<u16> for u64
1.5.0 (const: unstable) · sourceimpl From<u16> for u128
1.26.0 (const: unstable) · sourceimpl From<u16> for usize
1.26.0 (const: unstable) · sourceimpl From<u16> for AtomicU16
1.34.0 (const: unstable) · sourceimpl From<u32> for f64
1.6.0 (const: unstable) · sourceimpl From<u32> for i64
1.5.0 (const: unstable) · sourceimpl From<u32> for i128
1.26.0 (const: unstable) · sourceimpl From<u32> for u64
1.5.0 (const: unstable) · sourceimpl From<u32> for u128
1.26.0 (const: unstable) · sourceimpl From<u32> for Ipv4Addr
1.1.0 · sourceimpl From<u32> for AtomicU32
1.34.0 (const: unstable) · sourceimpl From<u64> for i128
1.26.0 (const: unstable) · sourceimpl From<u64> for u128
1.26.0 (const: unstable) · sourceimpl From<u64> for AtomicU64
1.34.0 (const: unstable) · sourceimpl From<u128> for Ipv6Addr
1.26.0 · sourceimpl From<usize> for AtomicUsize
1.23.0 (const: unstable) · sourceimpl From<CString> for Box<CStr, Global>
1.20.0 · sourceimpl From<CString> for Rc<CStr>
1.24.0 · sourceimpl From<CString> for Arc<CStr>
1.24.0 · sourceimpl From<CString> for Vec<u8, Global>
1.7.0 · sourceimpl From<NulError> for Error
sourceimpl From<__m128> for Simd<f32, 4_usize>
sourceimpl From<__m128d> for Simd<f64, 2_usize>
sourceimpl From<__m128i> for Simd<i8, 16_usize>
sourceimpl From<__m128i> for Simd<i16, 8_usize>
sourceimpl From<__m128i> for Simd<i32, 4_usize>
sourceimpl From<__m128i> for Simd<i64, 2_usize>
sourceimpl From<__m128i> for Simd<isize, 2_usize>
sourceimpl From<__m128i> for Simd<u8, 16_usize>
sourceimpl From<__m128i> for Simd<u16, 8_usize>
sourceimpl From<__m128i> for Simd<u32, 4_usize>
sourceimpl From<__m128i> for Simd<u64, 2_usize>
sourceimpl From<__m128i> for Simd<usize, 2_usize>
sourceimpl From<__m256> for Simd<f32, 8_usize>
sourceimpl From<__m256d> for Simd<f64, 4_usize>
sourceimpl From<__m256i> for Simd<i8, 32_usize>
sourceimpl From<__m256i> for Simd<i16, 16_usize>
sourceimpl From<__m256i> for Simd<i32, 8_usize>
sourceimpl From<__m256i> for Simd<i64, 4_usize>
sourceimpl From<__m256i> for Simd<isize, 4_usize>
sourceimpl From<__m256i> for Simd<u8, 32_usize>
sourceimpl From<__m256i> for Simd<u16, 16_usize>
sourceimpl From<__m256i> for Simd<u32, 8_usize>
sourceimpl From<__m256i> for Simd<u64, 4_usize>
sourceimpl From<__m256i> for Simd<usize, 4_usize>
sourceimpl From<__m512> for Simd<f32, 16_usize>
sourceimpl From<__m512d> for Simd<f64, 8_usize>
sourceimpl From<__m512i> for Simd<i8, 64_usize>
sourceimpl From<__m512i> for Simd<i16, 32_usize>
sourceimpl From<__m512i> for Simd<i32, 16_usize>
sourceimpl From<__m512i> for Simd<i64, 8_usize>
sourceimpl From<__m512i> for Simd<isize, 8_usize>
sourceimpl From<__m512i> for Simd<u8, 64_usize>
sourceimpl From<__m512i> for Simd<u16, 32_usize>
sourceimpl From<__m512i> for Simd<u32, 16_usize>
sourceimpl From<__m512i> for Simd<u64, 8_usize>
sourceimpl From<__m512i> for Simd<usize, 8_usize>
sourceimpl From<LayoutError> for TryReserveErrorKind
sourceimpl From<Box<str, Global>> for String
1.18.0 · sourceimpl From<Box<OsStr, Global>> for OsString
1.18.0 · sourceimpl From<Box<Path, Global>> for PathBuf
1.18.0 · sourceimpl From<OsString> for Box<OsStr>
1.20.0 · sourceimpl From<OsString> for PathBuf
sourceimpl From<OsString> for Rc<OsStr>
1.24.0 · sourceimpl From<OsString> for Arc<OsStr>
1.24.0 · sourceimpl From<File> for OwnedFd
sourceimpl From<File> for OwnedHandle
sourceimpl From<File> for Stdio
1.20.0 · sourceimpl From<Ipv4Addr> for IpAddr
1.16.0 · sourceimpl From<Ipv4Addr> for u32
1.1.0 · sourceimpl From<Ipv6Addr> for IpAddr
1.16.0 · sourceimpl From<Ipv6Addr> for u128
1.26.0 · sourceimpl From<SocketAddrV4> for SocketAddr
1.16.0 · sourceimpl From<SocketAddrV6> for SocketAddr
1.16.0 · sourceimpl From<TcpListener> for OwnedFd
sourceimpl From<TcpListener> for OwnedSocket
sourceimpl From<TcpStream> for OwnedFd
sourceimpl From<TcpStream> for OwnedSocket
sourceimpl From<UdpSocket> for OwnedFd
sourceimpl From<UdpSocket> for OwnedSocket
sourceimpl From<NonZeroI8> for i8
1.31.0 (const: unstable) · sourceimpl From<NonZeroI8> for NonZeroI16
1.41.0 (const: unstable) · sourceimpl From<NonZeroI8> for NonZeroI32
1.41.0 (const: unstable) · sourceimpl From<NonZeroI8> for NonZeroI64
1.41.0 (const: unstable) · sourceimpl From<NonZeroI8> for NonZeroI128
1.41.0 (const: unstable) · sourceimpl From<NonZeroI8> for NonZeroIsize
1.41.0 (const: unstable) · sourceimpl From<NonZeroI16> for i16
1.31.0 (const: unstable) · sourceimpl From<NonZeroI16> for NonZeroI32
1.41.0 (const: unstable) · sourceimpl From<NonZeroI16> for NonZeroI64
1.41.0 (const: unstable) · sourceimpl From<NonZeroI16> for NonZeroI128
1.41.0 (const: unstable) · sourceimpl From<NonZeroI16> for NonZeroIsize
1.41.0 (const: unstable) · sourceimpl From<NonZeroI32> for i32
1.31.0 (const: unstable) · sourceimpl From<NonZeroI32> for NonZeroI64
1.41.0 (const: unstable) · sourceimpl From<NonZeroI32> for NonZeroI128
1.41.0 (const: unstable) · sourceimpl From<NonZeroI64> for i64
1.31.0 (const: unstable) · sourceimpl From<NonZeroI64> for NonZeroI128
1.41.0 (const: unstable) · sourceimpl From<NonZeroI128> for i128
1.31.0 (const: unstable) · sourceimpl From<NonZeroIsize> for isize
1.31.0 (const: unstable) · sourceimpl From<NonZeroU8> for u8
1.31.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroI16
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroI32
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroI64
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroI128
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroIsize
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroU16
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroU32
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroU64
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroU128
1.41.0 (const: unstable) · sourceimpl From<NonZeroU8> for NonZeroUsize
1.41.0 (const: unstable) · sourceimpl From<NonZeroU16> for u16
1.31.0 (const: unstable) · sourceimpl From<NonZeroU16> for NonZeroI32
1.41.0 (const: unstable) · sourceimpl From<NonZeroU16> for NonZeroI64
1.41.0 (const: unstable) · sourceimpl From<NonZeroU16> for NonZeroI128
1.41.0 (const: unstable) · sourceimpl From<NonZeroU16> for NonZeroU32
1.41.0 (const: unstable) · sourceimpl From<NonZeroU16> for NonZeroU64
1.41.0 (const: unstable) · sourceimpl From<NonZeroU16> for NonZeroU128
1.41.0 (const: unstable) · sourceimpl From<NonZeroU16> for NonZeroUsize
1.41.0 (const: unstable) · sourceimpl From<NonZeroU32> for u32
1.31.0 (const: unstable) · sourceimpl From<NonZeroU32> for NonZeroI64
1.41.0 (const: unstable) · sourceimpl From<NonZeroU32> for NonZeroI128
1.41.0 (const: unstable) · sourceimpl From<NonZeroU32> for NonZeroU64
1.41.0 (const: unstable) · sourceimpl From<NonZeroU32> for NonZeroU128
1.41.0 (const: unstable) · sourceimpl From<NonZeroU64> for u64
1.31.0 (const: unstable) · sourceimpl From<NonZeroU64> for NonZeroI128
1.41.0 (const: unstable) · sourceimpl From<NonZeroU64> for NonZeroU128
1.41.0 (const: unstable) · sourceimpl From<NonZeroU128> for u128
1.31.0 (const: unstable) · sourceimpl From<NonZeroUsize> for usize
1.31.0 (const: unstable) · sourceimpl From<PidFd> for OwnedFd
sourceimpl From<OwnedFd> for File
sourceimpl From<OwnedFd> for TcpListener
sourceimpl From<OwnedFd> for TcpStream
sourceimpl From<OwnedFd> for UdpSocket
sourceimpl From<OwnedFd> for PidFd
sourceimpl From<OwnedFd> for UnixDatagram
sourceimpl From<OwnedFd> for UnixListener
sourceimpl From<OwnedFd> for UnixStream
sourceimpl From<OwnedFd> for Stdio
sourceimpl From<UnixDatagram> for OwnedFd
sourceimpl From<UnixListener> for OwnedFd
sourceimpl From<UnixStream> for OwnedFd
sourceimpl From<OwnedHandle> for File
sourceimpl From<OwnedHandle> for Stdio
sourceimpl From<OwnedSocket> for TcpListener
sourceimpl From<OwnedSocket> for TcpStream
sourceimpl From<OwnedSocket> for UdpSocket
sourceimpl From<PathBuf> for Box<Path>
1.20.0 · sourceimpl From<PathBuf> for OsString
1.14.0 · sourceimpl From<PathBuf> for Rc<Path>
1.24.0 · sourceimpl From<PathBuf> for Arc<Path>
1.24.0 · sourceimpl From<Child> for OwnedHandle
sourceimpl From<ChildStderr> for OwnedFd
sourceimpl From<ChildStderr> for OwnedHandle
sourceimpl From<ChildStderr> for Stdio
1.20.0 · sourceimpl From<ChildStdin> for OwnedFd
sourceimpl From<ChildStdin> for OwnedHandle
sourceimpl From<ChildStdin> for Stdio
1.20.0 · sourceimpl From<ChildStdout> for OwnedFd
sourceimpl From<ChildStdout> for OwnedHandle
sourceimpl From<ChildStdout> for Stdio
1.20.0 · sourceimpl From<Rc<str>> for Rc<[u8]>
1.62.0 · sourceimpl From<String> for Box<str, Global>
1.20.0 · sourceimpl From<String> for Box<dyn Error + Send + Sync>
sourceimpl From<String> for Box<dyn Error>
1.6.0 · sourceimpl From<String> for OsString
sourceimpl From<String> for PathBuf
sourceimpl From<String> for Rc<str>
1.21.0 · sourceimpl From<String> for Arc<str>
1.21.0 · sourceimpl From<String> for Vec<u8, Global>
1.14.0 · sourceimpl From<RecvError> for RecvTimeoutError
1.24.0 · sourceimpl From<RecvError> for TryRecvError
1.24.0 · sourceimpl From<Arc<str>> for Arc<[u8]>
1.62.0 · sourceimpl<'_> From<&'_ str> for Box<str, Global>
1.17.0 · sourceimpl<'_> From<&'_ str> for Rc<str>
1.21.0 · sourceimpl<'_> From<&'_ str> for String
sourceimpl<'_> From<&'_ str> for Arc<str>
1.21.0 · sourceimpl<'_> From<&'_ str> for Vec<u8, Global>
sourceimpl<'_> From<&'_ CStr> for Box<CStr, Global>
1.17.0 · sourceimpl<'_> From<&'_ CStr> for Rc<CStr>
1.24.0 · sourceimpl<'_> From<&'_ CStr> for Arc<CStr>
1.24.0 · sourceimpl<'_> From<&'_ String> for String
1.35.0 · sourceimpl<'_> From<&'_ mut str> for String
1.44.0 · sourceimpl<'_> From<Cow<'_, str>> for Box<str, Global>
1.45.0 · sourceimpl<'_> From<Cow<'_, CStr>> for Box<CStr, Global>
1.45.0 · sourceimpl<'_, T> From<Cow<'_, [T]>> for Box<[T], Global> where
T: Copy,
1.45.0 · sourceimpl<'_, T> From<&'_ T> for NonNull<T> where
T: ?Sized,
1.25.0 (const: unstable) · sourceimpl<'_, T> From<&'_ mut T> for NonNull<T> where
T: ?Sized,
1.25.0 (const: unstable) · sourceimpl<'_, T> From<&'_ [T]> for Box<[T], Global> where
T: Copy,
1.17.0 · sourceimpl<'_, T> From<&'_ [T]> for Rc<[T]> where
T: Clone,
1.21.0 · sourceimpl<'_, T> From<&'_ [T]> for Arc<[T]> where
T: Clone,
1.21.0 · sourceimpl<'_, T> From<&'_ [T]> for Vec<T, Global> where
T: Clone,
sourceimpl<'_, T> From<&'_ mut [T]> for Vec<T, Global> where
T: Clone,
1.19.0 · sourceimpl<'a> From<&'_ str> for Box<dyn Error + Send + Sync + 'a>
sourceimpl<'a> From<&'a str> for Cow<'a, str>
sourceimpl<'a> From<&'a CString> for Cow<'a, CStr>
1.28.0 · sourceimpl<'a> From<&'a CStr> for Cow<'a, CStr>
1.28.0 · sourceimpl<'a> From<&'a OsStr> for Cow<'a, OsStr>
1.28.0 · sourceimpl<'a> From<&'a OsString> for Cow<'a, OsStr>
1.28.0 · sourceimpl<'a> From<&'a Path> for Cow<'a, Path>
1.6.0 · sourceimpl<'a> From<&'a PathBuf> for Cow<'a, Path>
1.28.0 · sourceimpl<'a> From<&'a String> for Cow<'a, str>
1.28.0 · sourceimpl<'a> From<Cow<'a, str>> for Box<dyn Error>
1.22.0 · sourceimpl<'a> From<Cow<'a, str>> for String
1.14.0 · sourceimpl<'a> From<Cow<'a, OsStr>> for OsString
1.28.0 · sourceimpl<'a> From<Cow<'a, Path>> for PathBuf
1.28.0 · sourceimpl<'a> From<CString> for Cow<'a, CStr>
1.28.0 · sourceimpl<'a> From<OsString> for Cow<'a, OsStr>
1.28.0 · sourceimpl<'a> From<PathBuf> for Cow<'a, Path>
1.6.0 · sourceimpl<'a> From<String> for Cow<'a, str>
sourceimpl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a>
1.22.0 · sourceimpl<'a, B> From<Cow<'a, B>> for Rc<B> where
B: ToOwned + ?Sized,
Rc<B>: From<&'a B>,
Rc<B>: From<<B as ToOwned>::Owned>,
1.45.0 · sourceimpl<'a, B> From<Cow<'a, B>> for Arc<B> where
B: ToOwned + ?Sized,
Arc<B>: From<&'a B>,
Arc<B>: From<<B as ToOwned>::Owned>,
1.45.0 · sourceimpl<'a, E> From<E> for Report<Box<dyn Error + 'a>> where
E: Error + 'a,
sourceimpl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a>
sourceimpl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + 'a>
sourceimpl<'a, T> From<&'a Option<T>> for Option<&'a T>
1.30.0 (const: unstable) · sourceimpl<'a, T> From<&'a Vec<T, Global>> for Cow<'a, [T]> where
T: Clone,
1.28.0 · sourceimpl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T>
1.30.0 (const: unstable) · sourceimpl<'a, T> From<Cow<'a, [T]>> for Vec<T, Global> where
[T]: ToOwned,
<[T] as ToOwned>::Owned == Vec<T, Global>,
1.14.0 · sourceimpl<'a, T> From<&'a [T]> for Cow<'a, [T]> where
T: Clone,
1.8.0 · sourceimpl<'a, T> From<Vec<T, Global>> for Cow<'a, [T]> where
T: Clone,
1.8.0 · sourceimpl<A> From<Box<str, A>> for Box<[u8], A> where
A: Allocator,
1.19.0 · sourceimpl<E> From<E> for Report<E> where
E: Error,
sourceimpl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr
1.17.0 · sourceimpl<K, V, const N: usize> From<[(K, V); N]> for HashMap<K, V, RandomState> where
K: Eq + Hash,
1.56.0 · sourceimpl<K, V, const N: usize> From<[(K, V); N]> for BTreeMap<K, V> where
K: Ord,
1.56.0 · sourceimpl<T> From<!> for T
1.34.0 (const: unstable) · sourceStability note: This impl does not yet exist, but we are “reserving space” to add it in the future. See rust-lang/rust#64715 for details.