pub trait From<T>: Sized {
// Required method
fn from(value: 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 trait 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>.
From simplifies error handling by allowing a function to return a single error type
that encapsulates 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
§When to implement From
While there’s no technical restrictions on which conversions can be done using
a From implementation, the general expectation is that the conversions
should typically be restricted as follows:
-
The conversion is infallible: if the conversion can fail, use
TryFrominstead; don’t provide aFromimpl that panics. -
The conversion is lossless: semantically, it should not lose or discard information. For example,
i32: From<u16>exists, where the original value can be recovered usingu16: TryFrom<i32>. AndString: From<&str>exists, where you can get something equivalent to the original value viaDeref. ButFromcannot be used to convert fromu32tou16, since that cannot succeed in a lossless way. (There’s some wiggle room here for information not considered semantically relevant. For example,Box<[T]>: From<Vec<T>>exists even though it might not preserve capacity, like how two vectors can be equal despite differing capacities.) -
The conversion is value-preserving: the conceptual kind and meaning of the resulting value is the same, even though the Rust type and technical representation might be different. For example
-1_i8 as u8is lossless, sinceascasting back can recover the original value, but that conversion is not available viaFrombecause-1and255are different conceptual values (despite being identical bit patterns technically). Butf32: From<i16>is available because1_i16and1.0_f32are conceptually the same real number (despite having very different bit patterns technically).String: From<char>is available because they’re both text, butString: From<u32>is not available, since1(a number) and"1"(text) are too different. (Converting values to text is instead covered by theDisplaytrait.) -
The conversion is obvious: it’s the only reasonable conversion between the two types. Otherwise it’s better to have it be a named method or constructor, like how
str::as_bytesis a method and how integers have methods likeu32::from_ne_bytes,u32::from_le_bytes, andu32::from_be_bytes, none of which areFromimplementations. Whereas there’s only one reasonable way to wrap anIpv6Addrinto anIpAddr, thusIpAddr: From<Ipv6Addr>exists.
§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);While 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 with From::from.
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)
}Required Methods§
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§
impl From<&'static Tls12CipherSuite> for SupportedCipherSuite
impl From<&'static Tls13CipherSuite> for SupportedCipherSuite
impl From<&str> for Value
impl From<&str> for Arc<str>
impl From<&str> for Box<str>
impl From<&str> for Rc<str>
impl From<&str> for String
impl From<&str> for Vec<u8>
impl From<&CStr> for CString
impl From<&CStr> for Arc<CStr>
impl From<&CStr> for Box<CStr>
impl From<&CStr> for Rc<CStr>
impl From<&OsStr> for Arc<OsStr>
impl From<&OsStr> for Box<OsStr>
impl From<&OsStr> for Rc<OsStr>
impl From<&LanguageIdentifier> for (Language, Option<Script>, Option<Region>)
Convert from a LanguageIdentifier to an LSR tuple.
§Examples
use icu::locid::{
langid,
subtags::{language, region, script},
};
let lid = langid!("en-Latn-US");
let (lang, script, region) = (&lid).into();
assert_eq!(lang, language!("en"));
assert_eq!(script, Some(script!("Latn")));
assert_eq!(region, Some(region!("US")));impl From<&LanguageIdentifier> for DataLocale
impl From<&Locale> for DataLocale
impl From<&StreamResult> for Result<MZStatus, MZError>
impl From<&StreamResult> for Result<MZStatus, MZError>
impl From<&FlexZeroSlice> for FlexZeroVecOwned
impl From<&Path> for Arc<Path>
impl From<&Path> for Box<Path>
impl From<&Path> for Rc<Path>
impl From<&String> for String
impl From<&[u8; 12]> for Nonce
impl From<&[u8; 16]> for Nonce
impl From<&[u8]> for PrefixedPayload
impl From<&[u8]> for Tag
impl From<&[u32; 3]> for Nonce
impl From<&[BigEndian<u32>; 3]> for Nonce
impl From<&[LittleEndian<u32>; 3]> for Nonce
impl From<&mut str> for Arc<str>
impl From<&mut str> for Box<str>
impl From<&mut str> for Rc<str>
impl From<&mut str> for String
impl From<&mut CStr> for Arc<CStr>
impl From<&mut CStr> for Box<CStr>
impl From<&mut CStr> for Rc<CStr>
impl From<&mut OsStr> for Arc<OsStr>
impl From<&mut OsStr> for Box<OsStr>
impl From<&mut OsStr> for Rc<OsStr>
impl From<&mut Path> for Arc<Path>
impl From<&mut Path> for Box<Path>
impl From<&mut Path> for Rc<Path>
impl From<(Language, Option<Script>, Option<Region>)> for LanguageIdentifier
Convert from an LSR tuple to a LanguageIdentifier.
§Examples
use icu::locid::{
langid,
subtags::{language, region, script},
LanguageIdentifier,
};
let lang = language!("en");
let script = script!("Latn");
let region = region!("US");
assert_eq!(
LanguageIdentifier::from((lang, Some(script), Some(region))),
langid!("en-Latn-US")
);impl From<(Language, Option<Script>, Option<Region>)> for Locale
§Examples
use icu::locid::Locale;
use icu::locid::{
locale,
subtags::{language, region, script},
};
assert_eq!(
Locale::from((
language!("en"),
Some(script!("Latn")),
Some(region!("US"))
)),
locale!("en-Latn-US")
);impl From<AsciiChar> for char
impl From<AsciiChar> for u8
impl From<AsciiChar> for u16
impl From<AsciiChar> for u32
impl From<AsciiChar> for u64
impl From<AsciiChar> for u128
impl From<Cow<'_, str>> for Box<str>
impl From<Cow<'_, CStr>> for Box<CStr>
impl From<Cow<'_, OsStr>> for Box<OsStr>
impl From<Cow<'_, Path>> for Box<Path>
impl From<Infallible> for TryFromIntError
impl From<Infallible> for TryFromSliceError
impl From<IpAddr> for rustls_pki_types::server_name::IpAddr
impl From<IpAddr> for ServerName<'_>
impl From<Option<Region>> for LanguageIdentifier
§Examples
use icu::locid::{langid, subtags::region, LanguageIdentifier};
assert_eq!(
LanguageIdentifier::from(Some(region!("US"))),
langid!("und-US")
);impl From<Option<Region>> for Locale
§Examples
use icu::locid::Locale;
use icu::locid::{locale, subtags::region};
assert_eq!(Locale::from(Some(region!("US"))), locale!("und-US"));impl From<Option<Script>> for LanguageIdentifier
§Examples
use icu::locid::{langid, subtags::script, LanguageIdentifier};
assert_eq!(
LanguageIdentifier::from(Some(script!("latn"))),
langid!("und-Latn")
);impl From<Option<Script>> for Locale
§Examples
use icu::locid::Locale;
use icu::locid::{locale, subtags::script};
assert_eq!(Locale::from(Some(script!("latn"))), locale!("und-Latn"));impl From<TryReserveErrorKind> for TryReserveError
impl From<ErrorKind> for std::io::error::Error
Intended 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<DecryptionContext> for EncryptionContext
impl From<EncryptionContext> for DecryptionContext
impl From<PropertiesError> for NormalizerError
impl From<GeneralCategory> for GeneralCategoryGroup
impl From<CompressionStrategy> for i32
impl From<MZFlush> for TDEFLFlush
impl From<IpAddr> for hyperlane::IpAddr
impl From<IpAddr> for ServerName<'_>
impl From<Error> for ControlFlow<Error, Error>
impl From<EncryptError> for EarlyDataError
impl From<AlertDescription> for u8
impl From<CertificateCompressionAlgorithm> for u16
impl From<CipherSuite> for u16
impl From<ContentType> for u8
impl From<HandshakeType> for u8
impl From<ProtocolVersion> for u16
impl From<SignatureAlgorithm> for u8
impl From<SignatureScheme> for u16
impl From<CertRevocationListError> for rustls::error::Error
impl From<CertRevocationListError> for VerifierBuilderError
impl From<CertificateError> for AlertDescription
impl From<CertificateError> for rustls::error::Error
impl From<EncryptedClientHelloError> for rustls::error::Error
impl From<InconsistentKeys> for rustls::error::Error
impl From<InvalidMessage> for rustls::error::Error
impl From<PeerIncompatible> for rustls::error::Error
impl From<PeerMisbehaved> for rustls::error::Error
impl From<HashAlgorithm> for u8
impl From<NamedGroup> for u16
impl From<EmitterError> for serde_xml_rs::error::Error
impl From<bool> for Value
impl From<bool> for f32
impl From<bool> for f64
impl From<bool> for i8
impl From<bool> for i16
impl From<bool> for i32
impl From<bool> for i64
impl From<bool> for i128
impl From<bool> for isize
impl From<bool> for u8
impl From<bool> for u16
impl From<bool> for u32
impl From<bool> for u64
impl From<bool> for u128
impl From<bool> for usize
impl From<bool> for AtomicBool
impl From<char> for u32
impl From<char> for u64
impl From<char> for u128
impl From<char> for UnvalidatedChar
impl From<char> for String
impl From<f16> for f64
impl From<f16> for f128
impl From<f32> for Value
impl From<f32> for f64
impl From<f32> for f128
impl From<f64> for Value
impl From<f64> for f128
impl From<i8> for Value
impl From<i8> for f32
impl From<i8> for f64
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<i8> for AtomicI8
impl From<i8> for Number
impl From<i16> for Value
impl From<i16> for f32
impl From<i16> for f64
impl From<i16> for i32
impl From<i16> for i64
impl From<i16> for i128
impl From<i16> for isize
impl From<i16> for AtomicI16
impl From<i16> for Number
impl From<i16> for RawBytesULE<2>
impl From<i32> for Value
impl From<i32> for f64
impl From<i32> for i64
impl From<i32> for i128
impl From<i32> for AtomicI32
impl From<i32> for Number
impl From<i32> for RawBytesULE<4>
impl From<i64> for Value
impl From<i64> for i128
impl From<i64> for AtomicI64
impl From<i64> for Number
impl From<i64> for RawBytesULE<8>
impl From<i128> for RawBytesULE<16>
impl From<isize> for Value
impl From<isize> for AtomicIsize
impl From<isize> for Number
impl From<!> for Infallible
impl From<!> for TryFromIntError
impl From<u8> for AlertDescription
impl From<u8> for ContentType
impl From<u8> for HandshakeType
impl From<u8> for SignatureAlgorithm
impl From<u8> for HashAlgorithm
impl From<u8> for Value
impl From<u8> for char
Maps 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
impl From<u8> for f64
impl From<u8> for i16
impl From<u8> for i32
impl From<u8> for i64
impl From<u8> for i128
impl From<u8> for isize
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<u8> for AtomicU8
impl From<u8> for ExitCode
impl From<u8> for Number
impl From<u8> for Choice
impl From<u16> for CertificateCompressionAlgorithm
impl From<u16> for CipherSuite
impl From<u16> for ProtocolVersion
impl From<u16> for SignatureScheme
impl From<u16> for NamedGroup
impl From<u16> for Value
impl From<u16> for f32
impl From<u16> for f64
impl From<u16> for i32
impl From<u16> for i64
impl From<u16> for i128
impl From<u16> for u32
impl From<u16> for u64
impl From<u16> for u128
impl From<u16> for usize
impl From<u16> for AtomicU16
impl From<u16> for Number
impl From<u16> for RawBytesULE<2>
impl From<u32> for Value
impl From<u32> for f64
impl From<u32> for i64
impl From<u32> for i128
impl From<u32> for u64
impl From<u32> for u128
impl From<u32> for AtomicU32
impl From<u32> for GeneralCategoryGroup
impl From<u32> for Number
impl From<u32> for RawBytesULE<4>
impl From<u32> for hyperlane::Ipv4Addr
impl From<u64> for Value
impl From<u64> for i128
impl From<u64> for u128
impl From<u64> for AtomicU64
impl From<u64> for Number
impl From<u64> for RawBytesULE<8>
impl From<u128> for RawBytesULE<16>
impl From<u128> for hyperlane::Ipv6Addr
impl From<()> for Value
impl From<()> for KeyRejected
impl From<()> for Unspecified
impl From<usize> for Value
impl From<usize> for AtomicUsize
impl From<usize> for Number
impl From<OwnedFd> for File
impl From<OwnedFd> for PipeReader
impl From<OwnedFd> for PipeWriter
impl From<OwnedFd> for ChildStderr
Creates a ChildStderr from the provided OwnedFd.
The provided file descriptor must point to a pipe
with the CLOEXEC flag set.
impl From<OwnedFd> for ChildStdin
Creates a ChildStdin from the provided OwnedFd.
The provided file descriptor must point to a pipe
with the CLOEXEC flag set.
impl From<OwnedFd> for ChildStdout
Creates a ChildStdout from the provided OwnedFd.
The provided file descriptor must point to a pipe
with the CLOEXEC flag set.
impl From<OwnedFd> for Stdio
impl From<OwnedFd> for PidFd
impl From<OwnedFd> for TcpListener
impl From<OwnedFd> for TcpStream
impl From<OwnedFd> for UdpSocket
impl From<OwnedFd> for UnixDatagram
impl From<OwnedFd> for UnixListener
impl From<OwnedFd> for UnixStream
impl From<CString> for Arc<CStr>
impl From<CString> for Box<CStr>
impl From<CString> for Rc<CStr>
impl From<CString> for Vec<u8>
impl From<NulError> for std::io::error::Error
impl From<LayoutError> for TryReserveErrorKind
impl From<LayoutError> for CollectionAllocErr
impl From<__m128> for Simd<f32, 4>
impl From<__m128d> for Simd<f64, 2>
impl From<__m128i> for Simd<i8, 16>
impl From<__m128i> for Simd<i16, 8>
impl From<__m128i> for Simd<i32, 4>
impl From<__m128i> for Simd<i64, 2>
impl From<__m128i> for Simd<isize, 4>
impl From<__m128i> for Simd<u8, 16>
impl From<__m128i> for Simd<u16, 8>
impl From<__m128i> for Simd<u32, 4>
impl From<__m128i> for Simd<u64, 2>
impl From<__m128i> for Simd<usize, 4>
impl From<__m256> for Simd<f32, 8>
impl From<__m256d> for Simd<f64, 4>
impl From<__m256i> for Simd<i8, 32>
impl From<__m256i> for Simd<i16, 16>
impl From<__m256i> for Simd<i32, 8>
impl From<__m256i> for Simd<i64, 4>
impl From<__m256i> for Simd<isize, 8>
impl From<__m256i> for Simd<u8, 32>
impl From<__m256i> for Simd<u16, 16>
impl From<__m256i> for Simd<u32, 8>
impl From<__m256i> for Simd<u64, 4>
impl From<__m256i> for Simd<usize, 8>
impl From<__m512> for Simd<f32, 16>
impl From<__m512d> for Simd<f64, 8>
impl From<__m512i> for Simd<i8, 64>
impl From<__m512i> for Simd<i16, 32>
impl From<__m512i> for Simd<i32, 16>
impl From<__m512i> for Simd<i64, 8>
impl From<__m512i> for Simd<isize, 16>
impl From<__m512i> for Simd<u8, 64>
impl From<__m512i> for Simd<u16, 32>
impl From<__m512i> for Simd<u32, 16>
impl From<__m512i> for Simd<u64, 8>
impl From<__m512i> for Simd<usize, 16>
impl From<Simd<f32, 4>> for __m128
impl From<Simd<f32, 8>> for __m256
impl From<Simd<f32, 16>> for __m512
impl From<Simd<f64, 2>> for __m128d
impl From<Simd<f64, 4>> for __m256d
impl From<Simd<f64, 8>> for __m512d
impl From<Simd<i8, 16>> for __m128i
impl From<Simd<i8, 32>> for __m256i
impl From<Simd<i8, 64>> for __m512i
impl From<Simd<i16, 8>> for __m128i
impl From<Simd<i16, 16>> for __m256i
impl From<Simd<i16, 32>> for __m512i
impl From<Simd<i32, 4>> for __m128i
impl From<Simd<i32, 8>> for __m256i
impl From<Simd<i32, 16>> for __m512i
impl From<Simd<i64, 2>> for __m128i
impl From<Simd<i64, 4>> for __m256i
impl From<Simd<i64, 8>> for __m512i
impl From<Simd<isize, 4>> for __m128i
impl From<Simd<isize, 8>> for __m256i
impl From<Simd<isize, 16>> for __m512i
impl From<Simd<u8, 16>> for __m128i
impl From<Simd<u8, 32>> for __m256i
impl From<Simd<u8, 64>> for __m512i
impl From<Simd<u16, 8>> for __m128i
impl From<Simd<u16, 16>> for __m256i
impl From<Simd<u16, 32>> for __m512i
impl From<Simd<u32, 4>> for __m128i
impl From<Simd<u32, 8>> for __m256i
impl From<Simd<u32, 16>> for __m512i
impl From<Simd<u64, 2>> for __m128i
impl From<Simd<u64, 4>> for __m256i
impl From<Simd<u64, 8>> for __m512i
impl From<Simd<usize, 4>> for __m128i
impl From<Simd<usize, 8>> for __m256i
impl From<Simd<usize, 16>> for __m512i
impl From<Error> for ProcessingError
impl From<OsString> for Arc<OsStr>
impl From<OsString> for Box<OsStr>
impl From<OsString> for PathBuf
impl From<OsString> for Rc<OsStr>
impl From<File> for OwnedFd
impl From<File> for Stdio
impl From<Error> for serde_xml_rs::error::Error
impl From<Error> for EmitterError
impl From<Error> for xml::reader::error::Error
impl From<Stderr> for Stdio
impl From<Stdout> for Stdio
impl From<PipeReader> for OwnedFd
impl From<PipeReader> for Stdio
impl From<PipeWriter> for OwnedFd
impl From<PipeWriter> for Stdio
impl From<ChildStderr> for OwnedFd
impl From<ChildStderr> for Stdio
impl From<ChildStdin> for OwnedFd
impl From<ChildStdin> for Stdio
impl From<ChildStdout> for OwnedFd
impl From<ChildStdout> for Stdio
impl From<ExitStatusError> for ExitStatus
impl From<SystemTimeError> for rustls::error::Error
impl From<KeyRejected> for Unspecified
impl From<Unspecified> for ()
impl From<Unspecified> for KeyRejected
impl From<Okm<'_, &'static Algorithm>> for HeaderProtectionKey
impl From<Okm<'_, &'static Algorithm>> for UnboundKey
impl From<Okm<'_, &'static Algorithm>> for UnboundCipherKey
impl From<Okm<'_, Algorithm>> for Prk
impl From<Okm<'_, Algorithm>> for Salt
impl From<Okm<'_, Algorithm>> for Key
impl From<CompressError> for std::io::error::Error
impl From<DecompressError> for std::io::error::Error
impl From<Subtag> for TinyAsciiStr<8>
impl From<Subtag> for TinyAsciiStr<8>
impl From<Key> for TinyAsciiStr<2>
impl From<Attribute> for TinyAsciiStr<8>
impl From<Key> for TinyAsciiStr<2>
impl From<LanguageIdentifier> for Locale
impl From<LanguageIdentifier> for DataLocale
impl From<Locale> for LanguageIdentifier
impl From<Locale> for DataLocale
impl From<Language> for LanguageIdentifier
§Examples
use icu::locid::{langid, subtags::language, LanguageIdentifier};
assert_eq!(LanguageIdentifier::from(language!("en")), langid!("en"));impl From<Language> for Locale
§Examples
use icu::locid::Locale;
use icu::locid::{locale, subtags::language};
assert_eq!(Locale::from(language!("en")), locale!("en"));impl From<Language> for TinyAsciiStr<3>
impl From<Region> for TinyAsciiStr<3>
impl From<Script> for TinyAsciiStr<4>
impl From<Variant> for TinyAsciiStr<8>
impl From<GeneralCategoryGroup> for u32
impl From<AnyResponse> for DataResponse<AnyMarker>
impl From<DataError> for LocaleTransformError
impl From<DataError> for NormalizerError
impl From<DataError> for PropertiesError
impl From<Errors> for Result<(), Errors>
impl From<Errors> for ParseError
impl From<LiteMap<Key, Value>> for Fields
impl From<LiteMap<Key, Value, ShortBoxSlice<(Key, Value)>>> for Keywords
impl From<StreamResult> for Result<MZStatus, MZError>
impl From<StreamResult> for Result<MZStatus, MZError>
impl From<Ipv4Addr> for ServerName<'_>
impl From<Ipv4Addr> for hyperlane::Ipv4Addr
impl From<Ipv6Addr> for ServerName<'_>
impl From<Ipv6Addr> for hyperlane::Ipv6Addr
impl From<OwnedCertRevocationList> for CertRevocationList<'_>
impl From<ClientConnection> for rustls::conn::connection::Connection
impl From<EchConfig> for EchMode
impl From<EchGreaseConfig> for EchMode
impl From<ConnectionCommon<ServerConnectionData>> for AcceptedAlert
impl From<InsufficientSizeError> for EncodeError
impl From<InsufficientSizeError> for EncryptError
impl From<UnsupportedOperationError> for rustls::error::Error
impl From<OtherError> for rustls::error::Error
impl From<ClientConnection> for rustls::quic::connection::Connection
impl From<ServerConnection> for rustls::quic::connection::Connection
impl From<GetRandomFailed> for rustls::error::Error
impl From<ServerConnection> for rustls::conn::connection::Connection
impl From<Error> for std::io::error::Error
impl From<Map<String, Value>> for Value
impl From<Number> for Value
impl From<Choice> for bool
impl From<Url> for String
String conversion.
impl From<ParserConfig> for ParserConfig2
impl From<Error> for serde_xml_rs::error::Error
impl From<PidFd> for OwnedFd
impl From<RecvError> for RecvTimeoutError
impl From<RecvError> for TryRecvError
impl From<Alignment> for usize
impl From<Alignment> for NonZero<usize>
impl From<Arc<str>> for Arc<[u8]>
impl From<Box<str>> for Box<UnvalidatedStr>
impl From<Box<str>> for String
impl From<Box<CStr>> for CString
impl From<Box<OsStr>> for OsString
impl From<Box<Path>> for PathBuf
impl From<FromUtf8Error> for serde_xml_rs::error::Error
impl From<Ipv4Addr> for hyperlane::IpAddr
impl From<Ipv4Addr> for rustls_pki_types::server_name::IpAddr
impl From<Ipv4Addr> for ServerName<'_>
impl From<Ipv4Addr> for u32
impl From<Ipv4Addr> for rustls_pki_types::server_name::Ipv4Addr
impl From<Ipv6Addr> for hyperlane::IpAddr
impl From<Ipv6Addr> for rustls_pki_types::server_name::IpAddr
impl From<Ipv6Addr> for ServerName<'_>
impl From<Ipv6Addr> for u128
impl From<Ipv6Addr> for rustls_pki_types::server_name::Ipv6Addr
impl From<NonZero<i8>> for NonZero<i16>
impl From<NonZero<i8>> for NonZero<i32>
impl From<NonZero<i8>> for NonZero<i64>
impl From<NonZero<i8>> for NonZero<i128>
impl From<NonZero<i8>> for NonZero<isize>
impl From<NonZero<i16>> for NonZero<i32>
impl From<NonZero<i16>> for NonZero<i64>
impl From<NonZero<i16>> for NonZero<i128>
impl From<NonZero<i16>> for NonZero<isize>
impl From<NonZero<i32>> for NonZero<i64>
impl From<NonZero<i32>> for NonZero<i128>
impl From<NonZero<i64>> for NonZero<i128>
impl From<NonZero<u8>> for NonZero<i16>
impl From<NonZero<u8>> for NonZero<i32>
impl From<NonZero<u8>> for NonZero<i64>
impl From<NonZero<u8>> for NonZero<i128>
impl From<NonZero<u8>> for NonZero<isize>
impl From<NonZero<u8>> for NonZero<u16>
impl From<NonZero<u8>> for NonZero<u32>
impl From<NonZero<u8>> for NonZero<u64>
impl From<NonZero<u8>> for NonZero<u128>
impl From<NonZero<u8>> for NonZero<usize>
impl From<NonZero<u16>> for NonZero<i32>
impl From<NonZero<u16>> for NonZero<i64>
impl From<NonZero<u16>> for NonZero<i128>
impl From<NonZero<u16>> for NonZero<u32>
impl From<NonZero<u16>> for NonZero<u64>
impl From<NonZero<u16>> for NonZero<u128>
impl From<NonZero<u16>> for NonZero<usize>
impl From<NonZero<u32>> for NonZero<i64>
impl From<NonZero<u32>> for NonZero<i128>
impl From<NonZero<u32>> for NonZero<u64>
impl From<NonZero<u32>> for NonZero<u128>
impl From<NonZero<u64>> for NonZero<i128>
impl From<NonZero<u64>> for NonZero<u128>
impl From<ParseBoolError> for serde_xml_rs::error::Error
impl From<ParseFloatError> for serde_xml_rs::error::Error
impl From<ParseIntError> for serde_xml_rs::error::Error
impl From<PathBuf> for OsString
impl From<PathBuf> for Arc<Path>
impl From<PathBuf> for Box<Path>
impl From<PathBuf> for Rc<Path>
impl From<Rc<str>> for Rc<[u8]>
impl From<SocketAddrV4> for SocketAddr
impl From<SocketAddrV6> for SocketAddr
impl From<String> for Value
impl From<String> for OsString
impl From<String> for Arc<str>
impl From<String> for Box<str>
impl From<String> for PathBuf
impl From<String> for Rc<str>
impl From<String> for Vec<u8>
impl From<TcpListener> for OwnedFd
impl From<TcpStream> for OwnedFd
impl From<TryFromIntError> for KeyRejected
impl From<TryFromIntError> for Unspecified
impl From<TryFromSliceError> for Unspecified
impl From<TryReserveError> for std::io::error::Error
impl From<UdpSocket> for OwnedFd
impl From<Vec<u8>> for CertificateDer<'_>
impl From<Vec<u8>> for CertificateRevocationListDer<'_>
impl From<Vec<u8>> for CertificateSigningRequestDer<'_>
impl From<Vec<u8>> for Der<'static>
impl From<Vec<u8>> for EchConfigListBytes<'_>
impl From<Vec<u8>> for PrivatePkcs1KeyDer<'_>
impl From<Vec<u8>> for PrivatePkcs8KeyDer<'_>
impl From<Vec<u8>> for PrivateSec1KeyDer<'_>
impl From<Vec<u8>> for SubjectPublicKeyInfoDer<'_>
impl From<Vec<u8>> for HpkePrivateKey
impl From<Vec<u8>> for DistinguishedName
impl From<Vec<NonZero<u8>>> for CString
impl From<UnixDatagram> for OwnedFd
impl From<UnixListener> for OwnedFd
impl From<UnixStream> for OwnedFd
impl From<AeadCtx> for UnboundKey
impl From<AeadDirection> for u32
impl From<AlertLevel> for u8
impl From<BigEndian<u32>> for u32
impl From<BigEndian<u32>> for Nonce
impl From<BigEndian<u64>> for u64
impl From<CertificateStatusType> for u8
impl From<CertificateType> for u8
impl From<CharReadError> for xml::reader::error::Error
impl From<ClientCertificateType> for u8
impl From<Compression> for u8
impl From<ECCurveType> for u8
impl From<ECPointFormat> for u8
impl From<EchClientHelloType> for u8
impl From<EchVersion> for u16
impl From<ExtensionType> for u16
impl From<GzHeaderParser> for GzHeader
impl From<HeartbeatMessageType> for u8
impl From<HeartbeatMode> for u8
impl From<HpkeAead> for u16
impl From<HpkeKdf> for u16
impl From<HpkeKem> for u16
impl From<KeyUpdateRequest> for u8
impl From<LittleEndian<u32>> for u32
impl From<LittleEndian<u64>> for u64
impl From<Message<'_>> for PlainMessage
impl From<NamedCurve> for u16
impl From<PSKKeyExchangeMode> for u8
impl From<ParserNumber> for Number
impl From<PunycodeEncodeError> for ProcessingError
impl From<ServerNameType> for u8
impl From<Tag> for u8
impl From<Tag> for usize
impl From<[u8; 4]> for hyperlane::IpAddr
impl From<[u8; 4]> for hyperlane::Ipv4Addr
impl From<[u8; 12]> for Iv
impl From<[u8; 16]> for hyperlane::IpAddr
impl From<[u8; 16]> for hyperlane::Ipv6Addr
impl From<[u8; 32]> for AeadKey
impl From<[u16; 8]> for hyperlane::IpAddr
impl From<[u16; 8]> for rustls_pki_types::server_name::Ipv6Addr
impl From<[u16; 8]> for hyperlane::Ipv6Addr
impl From<u24> for usize
impl<'a> From<&'a str> for &'a UnvalidatedStr
impl<'a> From<&'a str> for Cow<'a, str>
impl<'a> From<&'a str> for XmlEvent<'a>
impl<'a> From<&'a str> for Name<'a>
impl<'a> From<&'a CString> for Cow<'a, CStr>
impl<'a> From<&'a CStr> for Cow<'a, CStr>
impl<'a> From<&'a OsStr> for Cow<'a, OsStr>
impl<'a> From<&'a OsString> for Cow<'a, OsStr>
impl<'a> From<&'a InputReferenceMut<'a>> for InputReference<'a>
impl<'a> From<&'a Path> for Cow<'a, Path>
impl<'a> From<&'a PathBuf> for Cow<'a, Path>
impl<'a> From<&'a String> for Cow<'a, str>
impl<'a> From<&'a [u8]> for OutboundChunks<'a>
impl<'a> From<&'a [u8]> for Ciphertext<'a>
impl<'a> From<&'a [u8]> for CertificateDer<'a>
impl<'a> From<&'a [u8]> for CertificateRevocationListDer<'a>
impl<'a> From<&'a [u8]> for CertificateSigningRequestDer<'a>
impl<'a> From<&'a [u8]> for Der<'a>
impl<'a> From<&'a [u8]> for EchConfigListBytes<'a>
impl<'a> From<&'a [u8]> for PrivatePkcs1KeyDer<'a>
impl<'a> From<&'a [u8]> for PrivatePkcs8KeyDer<'a>
impl<'a> From<&'a [u8]> for PrivateSec1KeyDer<'a>
impl<'a> From<&'a [u8]> for SubjectPublicKeyInfoDer<'a>
impl<'a> From<&'a [u8]> for Input<'a>
impl<'a> From<&'a mut Compat16x16> for CDF<'a>
impl<'a> From<&str> for Box<dyn Error + 'a>
impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a>
impl<'a> From<(&'a str, &'a str)> for Name<'a>
impl<'a> From<Cow<'a, str>> for Value
impl<'a> From<Cow<'a, str>> for String
impl<'a> From<Cow<'a, CStr>> for CString
impl<'a> From<Cow<'a, OsStr>> for OsString
impl<'a> From<Cow<'a, Path>> for PathBuf
impl<'a> From<CString> for Cow<'a, CStr>
impl<'a> From<OsString> for Cow<'a, OsStr>
impl<'a> From<InputReference<'a>> for SliceOffset
impl<'a> From<InputReferenceMut<'a>> for InputReference<'a>
impl<'a> From<PercentDecode<'a>> for Cow<'a, [u8]>
impl<'a> From<PercentEncode<'a>> for Cow<'a, str>
impl<'a> From<PrivatePkcs1KeyDer<'a>> for PrivateKeyDer<'a>
impl<'a> From<PrivatePkcs8KeyDer<'a>> for PrivateKeyDer<'a>
impl<'a> From<PrivateSec1KeyDer<'a>> for PrivateKeyDer<'a>
impl<'a> From<Cert<'a>> for TrustAnchor<'a>
impl<'a> From<BorrowedCertRevocationList<'a>> for CertRevocationList<'a>
impl<'a> From<Name<'a>> for OwnedName
impl<'a> From<EndElementBuilder<'a>> for XmlEvent<'a>
impl<'a> From<StartElementBuilder<'a>> for XmlEvent<'a>
impl<'a> From<PathBuf> for Cow<'a, Path>
impl<'a> From<String> for Cow<'a, str>
impl<'a> From<String> for Box<dyn Error + 'a>
impl<'a> From<String> for Box<dyn Error + Send + Sync + 'a>
impl<'a> From<Buffer<'a, Curve25519SeedBinType>> for Curve25519SeedBin<'a>
impl<'a> From<Buffer<'a, EcPrivateKeyBinType>> for EcPrivateKeyBin<'a>
impl<'a> From<Buffer<'a, EcPrivateKeyRfc5915DerType>> for EcPrivateKeyRfc5915Der<'a>
impl<'a> From<Buffer<'a, EcPublicKeyCompressedBinType>> for EcPublicKeyCompressedBin<'a>
impl<'a> From<Buffer<'a, EcPublicKeyUncompressedBinType>> for EcPublicKeyUncompressedBin<'a>
impl<'a> From<Buffer<'a, EncapsulationKeyBytesType>> for EncapsulationKeyBytes<'a>
impl<'a> From<Buffer<'a, Pkcs8V1DerType>> for Pkcs8V1Der<'a>
impl<'a> From<Buffer<'a, Pkcs8V2DerType>> for Pkcs8V2Der<'a>
impl<'a> From<Buffer<'a, PublicKeyX509DerType>> for PublicKeyX509Der<'a>
impl<'a> From<Slice<'a>> for Input<'a>
impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + 'a>
impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a>
impl<'a, A> From<&'a [<A as Array>::Item]> for SmallVec<A>
impl<'a, B> From<Cow<'a, B>> for Arc<B>
impl<'a, B> From<Cow<'a, B>> for Rc<B>
impl<'a, E> From<E> for Box<dyn Error + 'a>where
E: Error + 'a,
impl<'a, E> From<E> for Box<dyn Error + Send + Sync + 'a>
impl<'a, K0, K1, V> From<ZeroMap2dBorrowed<'a, K0, K1, V>> for ZeroMap2d<'a, K0, K1, V>
impl<'a, K, V> From<ZeroMapBorrowed<'a, K, V>> for ZeroMap<'a, K, V>
impl<'a, P, M> From<(&'a P, M)> for xml::reader::error::Error
impl<'a, T> From<&'a Option<T>> for Option<&'a T>
impl<'a, T> From<&'a [T]> for Cow<'a, [T]>where
T: Clone,
impl<'a, T> From<&'a Vec<T>> for Cow<'a, [T]>where
T: Clone,
impl<'a, T> From<&'a [<T as AsULE>::ULE]> for ZeroVec<'a, T>where
T: AsULE,
impl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T>
impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
impl<'a, T> From<Vec<<T as AsULE>::ULE>> for ZeroVec<'a, T>where
T: AsULE,
impl<'a, T> From<Vec<T>> for Cow<'a, [T]>where
T: Clone,
impl<'a, T, F> From<&'a VarZeroSlice<T, F>> for VarZeroVec<'a, T, F>where
T: ?Sized,
impl<'a, T, F> From<&'a VarZeroSlice<T, F>> for VarZeroVecOwned<T, F>
impl<'a, T, F> From<VarZeroVec<'a, T, F>> for VarZeroVecOwned<T, F>
impl<'a, T, F> From<VarZeroVecOwned<T, F>> for VarZeroVec<'a, T, F>where
T: ?Sized,
impl<'a, T, const N: usize> From<&'a [T; N]> for Cow<'a, [T]>where
T: Clone,
impl<'c, 'i, Data> From<ReadEarlyData<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>
impl<'c, 'i, Data> From<ReadTraffic<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>
impl<'c, Data> From<EncodeTlsData<'c, Data>> for ConnectionState<'c, '_, Data>
impl<'c, Data> From<TransmitTlsData<'c, Data>> for ConnectionState<'c, '_, Data>
impl<'data> From<&'data mut [u8]> for BorrowedBuf<'data>
Creates a new BorrowedBuf from a fully initialized slice.
impl<'data> From<&'data mut [MaybeUninit<u8>]> for BorrowedBuf<'data>
Creates a new BorrowedBuf from an uninitialized buffer.
Use set_init if part of the buffer is known to be already initialized.
impl<'key> From<Key<'key>> for Cow<'static, str>
impl<'l> From<&'l Subtag> for &'l str
impl<'l> From<&'l Subtag> for &'l str
impl<'l> From<&'l Key> for &'l str
impl<'l> From<&'l Attribute> for &'l str
impl<'l> From<&'l Key> for &'l str
impl<'l> From<&'l Language> for &'l str
impl<'l> From<&'l Region> for &'l str
impl<'l> From<&'l Script> for &'l str
impl<'l> From<&'l Variant> for &'l str
impl<A> From<Box<str, A>> for Box<[u8], A>where
A: Allocator,
impl<A> From<Vec<<A as Array>::Item>> for SmallVec<A>where
A: Array,
impl<A> From<A> for SmallVec<A>where
A: Array,
impl<A, T, F> From<&[A]> for VarZeroVec<'static, T, F>
impl<A, T, F> From<&Vec<A>> for VarZeroVec<'static, T, F>
impl<A, T, F, const N: usize> From<&[A; N]> for VarZeroVec<'static, T, F>
impl<Data> From<ConnectionCore<Data>> for rustls::conn::ConnectionCommon<Data>
impl<Data> From<ConnectionCore<Data>> for UnbufferedConnectionCommon<Data>
impl<Data> From<ConnectionCore<Data>> for rustls::quic::connection::ConnectionCommon<Data>
impl<E> From<E> for Report<E>where
E: Error,
impl<I> From<(I, u16)> for SocketAddr
impl<K, V, const N: usize> From<[(K, V); N]> for BTreeMap<K, V>where
K: Ord,
impl<K, V, const N: usize> From<[(K, V); N]> for HashMap<K, V>
impl<T> From<&[T]> for Value
impl<T> From<&[T]> for Arc<[T]>where
T: Clone,
impl<T> From<&[T]> for Box<[T]>where
T: Clone,
impl<T> From<&[T]> for Rc<[T]>where
T: Clone,
impl<T> From<&[T]> for Vec<T>where
T: Clone,
impl<T> From<&mut [T]> for Arc<[T]>where
T: Clone,
impl<T> From<&mut [T]> for Box<[T]>where
T: Clone,
impl<T> From<&mut [T]> for Rc<[T]>where
T: Clone,
impl<T> From<&mut [T]> for Vec<T>where
T: Clone,
impl<T> From<Cow<'_, [T]>> for Box<[T]>where
T: Clone,
impl<T> From<Option<T>> for Value
impl<T> From<[T; N]> for (T₁, T₂, …, Tₙ)
This trait is implemented for tuples up to twelve items long.
impl<T> From<!> for T
Stability 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.
impl<T> From<*mut T> for AtomicPtr<T>
impl<T> From<&T> for OsString
impl<T> From<&T> for NonNull<T>where
T: ?Sized,
impl<T> From<&T> for PathBuf
impl<T> From<&mut T> for NonNull<T>where
T: ?Sized,
impl<T> From<(T₁, T₂, …, Tₙ)> for [T; N]
This trait is implemented for tuples up to twelve items long.