Movatterモバイル変換


[0]ホーム

URL:


From

core::convert

TraitFrom 

1.6.0 (const:unstable) ·Source
pub trait From<T>:Sized {    // Required method    fnfrom(value: T) -> Self;}
Expand description

Used to do value-to-value conversions while consuming the input value. It is the reciprocal ofInto.

One should always prefer implementingFrom overIntobecause implementingFrom automatically provides one with an implementation ofIntothanks to the blanket implementation in the standard library.

Only implementInto when targeting a version prior to Rust 1.41 and converting to a typeoutside the current crate.From was not able to do these types of conversions in earlier versions because of Rust’sorphaning rules.SeeInto for more details.

Prefer usingInto overFrom when specifying trait bounds on a generic functionto ensure that types that only implementInto can be used as well.

TheFrom trait is also very useful when performing error handling. When constructing a functionthat is capable of failing, the return type will generally be of the formResult<T, E>.From simplifies error handling by allowing a function to return a single error typethat encapsulates multiple error types. See the “Examples” section andthe book for moredetails.

Note: This trait must not fail. TheFrom trait is intended for perfect conversions.If the conversion can fail or is not perfect, useTryFrom.

§Generic Implementations

  • From<T> for U impliesInto<U> for T
  • From is reflexive, which means thatFrom<T> for T is implemented

§When to implementFrom

While there’s no technical restrictions on which conversions can be done usingaFrom implementation, the general expectation is that the conversionsshould typically be restricted as follows:

  • The conversion isinfallible: if the conversion can fail, useTryFrominstead; don’t provide aFrom impl that panics.

  • The conversion islossless: semantically, it should not lose or discardinformation. For example,i32: From<u16> exists, where the originalvalue can be recovered usingu16: TryFrom<i32>. AndString: From<&str>exists, where you can get something equivalent to the original value viaDeref. ButFrom cannot be used to convert fromu32 tou16, sincethat cannot succeed in a lossless way. (There’s some wiggle room here forinformation 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 isvalue-preserving: the conceptual kind and meaning ofthe resulting value is the same, even though the Rust type and technicalrepresentation might be different. For example-1_i8 as u8 islossless,sinceas casting back can recover the original value, but that conversionisnot available viaFrom because-1 and255 are different conceptualvalues (despite being identical bit patterns technically). Butf32: From<i16>is available because1_i16 and1.0_f32 are conceptuallythe same real number (despite having very different bit patterns technically).String: From<char> is available because they’re bothtext, butString: From<u32> isnot available, since1 (a number) and"1"(text) are too different. (Converting values to text is instead coveredby theDisplay trait.)

  • The conversion isobvious: it’s the only reasonable conversion betweenthe two types. Otherwise it’s better to have it be a named method orconstructor, like howstr::as_bytes is a method and how integers havemethods likeu32::from_ne_bytes,u32::from_le_bytes, andu32::from_be_bytes, none of which areFrom implementations. Whereasthere’s only one reasonable way to wrap anIpv6Addrinto anIpAddr, thusIpAddr: From<Ipv6Addr> exists.

§Examples

String implementsFrom<&str>:

An explicit conversion from a&str to a String is done as follows:

letstring ="hello".to_string();letother_string = String::from("hello");assert_eq!(string, other_string);

While performing error handling it is often useful to implementFrom for your own error type.By converting underlying error types to our own custom error type that encapsulates theunderlying error type, we can return a single error type without losing information on theunderlying cause. The ‘?’ operator automatically converts the underlying error type to ourcustom error type withFrom::from.

usestd::fs;usestd::io;usestd::num;enumCliError {    IoError(io::Error),    ParseError(num::ParseIntError),}implFrom<io::Error>forCliError {fnfrom(error: io::Error) ->Self{        CliError::IoError(error)    }}implFrom<num::ParseIntError>forCliError {fnfrom(error: num::ParseIntError) ->Self{        CliError::ParseError(error)    }}fnopen_and_parse_file(file_name:&str) ->Result<i32, CliError> {letmutcontents = fs::read_to_string(&file_name)?;letnum: i32 = contents.trim().parse()?;Ok(num)}

Required Methods§

1.0.0 ·Source

fnfrom(value: T) -> Self

Converts to this type from the input type.

Dyn Compatibility§

This trait isnotdyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

implFrom<AsciiChar> forchar

Source§

implFrom<AsciiChar> foru8

Source§

implFrom<AsciiChar> foru16

Source§

implFrom<AsciiChar> foru32

Source§

implFrom<AsciiChar> foru64

Source§

implFrom<AsciiChar> foru128

1.36.0 (const:unstable) ·Source§

implFrom<Infallible> forTryFromSliceError

1.34.0 (const:unstable) ·Source§

implFrom<Infallible> forTryFromIntError

1.68.0 (const:unstable) ·Source§

implFrom<bool> forf16

1.68.0 (const:unstable) ·Source§

implFrom<bool> forf32

1.68.0 (const:unstable) ·Source§

implFrom<bool> forf64

1.68.0 (const:unstable) ·Source§

implFrom<bool> forf128

1.28.0 (const:unstable) ·Source§

implFrom<bool> fori8

1.28.0 (const:unstable) ·Source§

implFrom<bool> fori16

1.28.0 (const:unstable) ·Source§

implFrom<bool> fori32

1.28.0 (const:unstable) ·Source§

implFrom<bool> fori64

1.28.0 (const:unstable) ·Source§

implFrom<bool> fori128

1.28.0 (const:unstable) ·Source§

implFrom<bool> forisize

1.28.0 (const:unstable) ·Source§

implFrom<bool> foru8

1.28.0 (const:unstable) ·Source§

implFrom<bool> foru16

1.28.0 (const:unstable) ·Source§

implFrom<bool> foru32

1.28.0 (const:unstable) ·Source§

implFrom<bool> foru64

1.28.0 (const:unstable) ·Source§

implFrom<bool> foru128

1.28.0 (const:unstable) ·Source§

implFrom<bool> forusize

1.24.0 (const:unstable) ·Source§

implFrom<bool> forAtomicBool

1.13.0 (const:unstable) ·Source§

implFrom<char> foru32

1.51.0 (const:unstable) ·Source§

implFrom<char> foru64

1.51.0 (const:unstable) ·Source§

implFrom<char> foru128

1.6.0 (const:unstable) ·Source§

implFrom<f16> forf64

1.6.0 (const:unstable) ·Source§

implFrom<f16> forf128

1.6.0 (const:unstable) ·Source§

implFrom<f32> forf64

1.6.0 (const:unstable) ·Source§

implFrom<f32> forf128

1.6.0 (const:unstable) ·Source§

implFrom<f64> forf128

1.6.0 (const:unstable) ·Source§

implFrom<i8> forf16

1.6.0 (const:unstable) ·Source§

implFrom<i8> forf32

1.6.0 (const:unstable) ·Source§

implFrom<i8> forf64

1.6.0 (const:unstable) ·Source§

implFrom<i8> forf128

1.5.0 (const:unstable) ·Source§

implFrom<i8> fori16

1.5.0 (const:unstable) ·Source§

implFrom<i8> fori32

1.5.0 (const:unstable) ·Source§

implFrom<i8> fori64

1.26.0 (const:unstable) ·Source§

implFrom<i8> fori128

1.5.0 (const:unstable) ·Source§

implFrom<i8> forisize

1.34.0 (const:unstable) ·Source§

implFrom<i8> forAtomicI8

1.6.0 (const:unstable) ·Source§

implFrom<i16> forf32

1.6.0 (const:unstable) ·Source§

implFrom<i16> forf64

1.6.0 (const:unstable) ·Source§

implFrom<i16> forf128

1.5.0 (const:unstable) ·Source§

implFrom<i16> fori32

1.5.0 (const:unstable) ·Source§

implFrom<i16> fori64

1.26.0 (const:unstable) ·Source§

implFrom<i16> fori128

1.26.0 (const:unstable) ·Source§

implFrom<i16> forisize

1.34.0 (const:unstable) ·Source§

implFrom<i16> forAtomicI16

1.6.0 (const:unstable) ·Source§

implFrom<i32> forf64

1.6.0 (const:unstable) ·Source§

implFrom<i32> forf128

1.5.0 (const:unstable) ·Source§

implFrom<i32> fori64

1.26.0 (const:unstable) ·Source§

implFrom<i32> fori128

1.34.0 (const:unstable) ·Source§

implFrom<i32> forAtomicI32

1.26.0 (const:unstable) ·Source§

implFrom<i64> fori128

1.34.0 (const:unstable) ·Source§

implFrom<i64> forAtomicI64

1.23.0 (const:unstable) ·Source§

implFrom<isize> forAtomicIsize

1.34.0 (const:unstable) ·Source§

implFrom<!> forInfallible

Source§

implFrom<!> forTryFromIntError

1.13.0 (const:unstable) ·Source§

implFrom<u8> forchar

Maps a byte in 0x00..=0xFF to achar whose code point has the same value, in U+0000..=U+00FF.

Unicode is designed such that this effectively decodes byteswith 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 isalso different from Windows-1252 a.k.a. code page 1252,which is a superset ISO/IEC 8859-1 that assigns some (not all!) blanksto punctuation and various Latin characters.

To confuse things further,on the Webascii,iso-8859-1, andwindows-1252 are all aliasesfor a superset of Windows-1252 that fills the remaining blanks with correspondingC0 and C1 control codes.

1.6.0 (const:unstable) ·Source§

implFrom<u8> forf16

1.6.0 (const:unstable) ·Source§

implFrom<u8> forf32

1.6.0 (const:unstable) ·Source§

implFrom<u8> forf64

1.6.0 (const:unstable) ·Source§

implFrom<u8> forf128

1.5.0 (const:unstable) ·Source§

implFrom<u8> fori16

1.5.0 (const:unstable) ·Source§

implFrom<u8> fori32

1.5.0 (const:unstable) ·Source§

implFrom<u8> fori64

1.26.0 (const:unstable) ·Source§

implFrom<u8> fori128

1.26.0 (const:unstable) ·Source§

implFrom<u8> forisize

1.5.0 (const:unstable) ·Source§

implFrom<u8> foru16

1.5.0 (const:unstable) ·Source§

implFrom<u8> foru32

1.5.0 (const:unstable) ·Source§

implFrom<u8> foru64

1.26.0 (const:unstable) ·Source§

implFrom<u8> foru128

1.5.0 (const:unstable) ·Source§

implFrom<u8> forusize

1.34.0 (const:unstable) ·Source§

implFrom<u8> forAtomicU8

1.6.0 (const:unstable) ·Source§

implFrom<u16> forf32

1.6.0 (const:unstable) ·Source§

implFrom<u16> forf64

1.6.0 (const:unstable) ·Source§

implFrom<u16> forf128

1.5.0 (const:unstable) ·Source§

implFrom<u16> fori32

1.5.0 (const:unstable) ·Source§

implFrom<u16> fori64

1.26.0 (const:unstable) ·Source§

implFrom<u16> fori128

1.5.0 (const:unstable) ·Source§

implFrom<u16> foru32

1.5.0 (const:unstable) ·Source§

implFrom<u16> foru64

1.26.0 (const:unstable) ·Source§

implFrom<u16> foru128

1.26.0 (const:unstable) ·Source§

implFrom<u16> forusize

1.34.0 (const:unstable) ·Source§

implFrom<u16> forAtomicU16

1.6.0 (const:unstable) ·Source§

implFrom<u32> forf64

1.6.0 (const:unstable) ·Source§

implFrom<u32> forf128

1.5.0 (const:unstable) ·Source§

implFrom<u32> fori64

1.26.0 (const:unstable) ·Source§

implFrom<u32> fori128

1.5.0 (const:unstable) ·Source§

implFrom<u32> foru64

1.26.0 (const:unstable) ·Source§

implFrom<u32> foru128

1.1.0 (const:unstable) ·Source§

implFrom<u32> forIpv4Addr

1.34.0 (const:unstable) ·Source§

implFrom<u32> forAtomicU32

1.26.0 (const:unstable) ·Source§

implFrom<u64> fori128

1.26.0 (const:unstable) ·Source§

implFrom<u64> foru128

1.34.0 (const:unstable) ·Source§

implFrom<u64> forAtomicU64

1.26.0 (const:unstable) ·Source§

implFrom<u128> forIpv6Addr

1.23.0 (const:unstable) ·Source§

implFrom<usize> forAtomicUsize

Source§

implFrom<__m128> forf32x4

Available onx86 or x86-64 only.
Source§

implFrom<__m128d> forf64x2

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> fori8x16

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> fori16x8

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> fori32x4

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> fori64x2

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> forisizex2

Available on(x86 or x86-64) only.
Source§

implFrom<__m128i> foru8x16

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> foru16x8

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> foru32x4

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> foru64x2

Available onx86 or x86-64 only.
Source§

implFrom<__m128i> forusizex2

Available on(x86 or x86-64) only.
Source§

implFrom<__m256> forf32x8

Available onx86 or x86-64 only.
Source§

implFrom<__m256d> forf64x4

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> fori8x32

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> fori16x16

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> fori32x8

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> fori64x4

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> forisizex4

Available on(x86 or x86-64) only.
Source§

implFrom<__m256i> foru8x32

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> foru16x16

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> foru32x8

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> foru64x4

Available onx86 or x86-64 only.
Source§

implFrom<__m256i> forusizex4

Available on(x86 or x86-64) only.
Source§

implFrom<__m512> forf32x16

Available onx86 or x86-64 only.
Source§

implFrom<__m512d> forf64x8

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> fori8x64

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> fori16x32

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> fori32x16

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> fori64x8

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> forisizex8

Available on(x86 or x86-64) only.
Source§

implFrom<__m512i> foru8x64

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> foru16x32

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> foru32x16

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> foru64x8

Available onx86 or x86-64 only.
Source§

implFrom<__m512i> forusizex8

Available on(x86 or x86-64) only.
1.16.0 (const:unstable) ·Source§

implFrom<Ipv4Addr> forIpAddr

1.1.0 (const:unstable) ·Source§

implFrom<Ipv4Addr> foru32

1.16.0 (const:unstable) ·Source§

implFrom<Ipv6Addr> forIpAddr

1.26.0 (const:unstable) ·Source§

implFrom<Ipv6Addr> foru128

1.16.0 (const:unstable) ·Source§

implFrom<SocketAddrV4> forSocketAddr

1.16.0 (const:unstable) ·Source§

implFrom<SocketAddrV6> forSocketAddr

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i8>> forNonZero<i16>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i8>> forNonZero<i32>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i8>> forNonZero<i64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i8>> forNonZero<i128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i8>> forNonZero<isize>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i16>> forNonZero<i32>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i16>> forNonZero<i64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i16>> forNonZero<i128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i16>> forNonZero<isize>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i32>> forNonZero<i64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i32>> forNonZero<i128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<i64>> forNonZero<i128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<i16>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<i32>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<i64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<i128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<isize>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<u16>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<u32>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<u64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<u128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u8>> forNonZero<usize>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u16>> forNonZero<i32>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u16>> forNonZero<i64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u16>> forNonZero<i128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u16>> forNonZero<u32>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u16>> forNonZero<u64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u16>> forNonZero<u128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u16>> forNonZero<usize>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u32>> forNonZero<i64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u32>> forNonZero<i128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u32>> forNonZero<u64>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u32>> forNonZero<u128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u64>> forNonZero<i128>

1.41.0 (const:unstable) ·Source§

implFrom<NonZero<u64>> forNonZero<u128>

Source§

implFrom<Alignment> forusize

Source§

implFrom<Alignment> forNonZero<usize>

Source§

implFrom<Simd<f32, 4>> for__m128

Available onx86 or x86-64 only.
Source§

implFrom<Simd<f32, 8>> for__m256

Available onx86 or x86-64 only.
Source§

implFrom<Simd<f32, 16>> for__m512

Available onx86 or x86-64 only.
Source§

implFrom<Simd<f64, 2>> for__m128d

Available onx86 or x86-64 only.
Source§

implFrom<Simd<f64, 4>> for__m256d

Available onx86 or x86-64 only.
Source§

implFrom<Simd<f64, 8>> for__m512d

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i8, 16>> for__m128i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i8, 32>> for__m256i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i8, 64>> for__m512i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i16, 8>> for__m128i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i16, 16>> for__m256i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i16, 32>> for__m512i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i32, 4>> for__m128i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i32, 8>> for__m256i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i32, 16>> for__m512i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i64, 2>> for__m128i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i64, 4>> for__m256i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<i64, 8>> for__m512i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<isize, 2>> for__m128i

Available on(x86 or x86-64) only.
Source§

implFrom<Simd<isize, 4>> for__m256i

Available on(x86 or x86-64) only.
Source§

implFrom<Simd<isize, 8>> for__m512i

Available on(x86 or x86-64) only.
Source§

implFrom<Simd<u8, 16>> for__m128i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u8, 32>> for__m256i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u8, 64>> for__m512i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u16, 8>> for__m128i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u16, 16>> for__m256i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u16, 32>> for__m512i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u32, 4>> for__m128i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u32, 8>> for__m256i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u32, 16>> for__m512i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u64, 2>> for__m128i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u64, 4>> for__m256i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<u64, 8>> for__m512i

Available onx86 or x86-64 only.
Source§

implFrom<Simd<usize, 2>> for__m128i

Available on(x86 or x86-64) only.
Source§

implFrom<Simd<usize, 4>> for__m256i

Available on(x86 or x86-64) only.
Source§

implFrom<Simd<usize, 8>> for__m512i

Available on(x86 or x86-64) only.
1.17.0 (const:unstable) ·Source§

implFrom<[u8;4]> forIpAddr

1.9.0 (const:unstable) ·Source§

implFrom<[u8;4]> forIpv4Addr

1.17.0 (const:unstable) ·Source§

implFrom<[u8;16]> forIpAddr

1.9.0 (const:unstable) ·Source§

implFrom<[u8;16]> forIpv6Addr

1.17.0 (const:unstable) ·Source§

implFrom<[u16;8]> forIpAddr

1.16.0 (const:unstable) ·Source§

implFrom<[u16;8]> forIpv6Addr

1.30.0 (const:unstable) ·Source§

impl<'a, T>From<&'aOption<T>> forOption<&'a T>

1.30.0 (const:unstable) ·Source§

impl<'a, T>From<&'a mutOption<T>> forOption<&'a mut T>

Source§

impl<'data>From<&'data mut [u8]> forBorrowedBuf<'data>

Creates a newBorrowedBuf from a fully initialized slice.

Source§

impl<'data>From<&'data mut [MaybeUninit<u8>]> forBorrowedBuf<'data>

Creates a newBorrowedBuf from an uninitialized buffer.

Useset_init if part of the buffer is known to be already initialized.

Source§

impl<'data>From<BorrowedCursor<'data>> forBorrowedBuf<'data>

Creates a newBorrowedBuf from a cursor.

UseBorrowedCursor::with_unfilled_buf instead for a safer alternative.

1.17.0 (const:unstable) ·Source§

impl<I:Into<IpAddr>>From<(I,u16)> forSocketAddr

1.71.0 ·Source§

impl<T>From<[T; N]> for(T₁, T₂, …, Tₙ)

This trait is implemented for tuples up to twelve items long.

1.34.0 (const:unstable) ·Source§

impl<T>From<!> for T

Stability note: This impl does not yet exist, but we are“reserving space” to add it in the future. Seerust-lang/rust#64715 for details.

1.23.0 (const:unstable) ·Source§

impl<T>From<*mut T> forAtomicPtr<T>

1.71.0 ·Source§

impl<T>From<(T₁, T₂, …, Tₙ)> for[T; N]

This trait is implemented for tuples up to twelve items long.

1.31.0 (const:unstable) ·Source§

impl<T>From<NonZero<T>> for T

Source§

impl<T>From<Range<T>> for core::range::Range<T>

Source§

impl<T>From<RangeFrom<T>> for core::range::RangeFrom<T>

Source§

impl<T>From<RangeInclusive<T>> for core::range::RangeInclusive<T>

Source§

impl<T>From<RangeToInclusive<T>> for core::range::RangeToInclusive<T>

Source§

impl<T>From<Range<T>> for core::ops::Range<T>

Source§

impl<T>From<RangeFrom<T>> for core::ops::RangeFrom<T>

Source§

impl<T>From<RangeInclusive<T>> for core::ops::RangeInclusive<T>

Source§

impl<T>From<RangeToInclusive<T>> for core::ops::RangeToInclusive<T>

1.12.0 (const:unstable) ·Source§

impl<T>From<T> forOption<T>

1.36.0 (const:unstable) ·Source§

impl<T>From<T> forPoll<T>

1.12.0 (const:unstable) ·Source§

impl<T>From<T> forCell<T>

1.70.0 (const:unstable) ·Source§

impl<T>From<T> forOnceCell<T>

1.12.0 (const:unstable) ·Source§

impl<T>From<T> forRefCell<T>

Source§

impl<T>From<T> forSyncUnsafeCell<T>

1.12.0 (const:unstable) ·Source§

impl<T>From<T> forUnsafeCell<T>

Source§

impl<T>From<T> forUnsafePinned<T>

Source§

impl<T>From<T> forExclusive<T>

1.0.0 (const:unstable) ·Source§

impl<T>From<T> for T

Source§

impl<T, const N:usize>From<[T; N]> forSimd<T, N>

Source§

impl<T, const N:usize>From<Mask<T, N>> for [bool;N]

Source§

impl<T, const N:usize>From<Simd<T, N>> for[T; N]

Source§

impl<T, const N:usize>From<[bool;N]> forMask<T, N>

1.25.0 (const:unstable) ·Source§

impl<T:PointeeSized>From<&T> forNonNull<T>

1.25.0 (const:unstable) ·Source§

impl<T:PointeeSized>From<&mut T> forNonNull<T>

Source§

impl<const N:usize>From<Mask<i8, N>> forMask<i16, N>

Source§

impl<const N:usize>From<Mask<i8, N>> forMask<i32, N>

Source§

impl<const N:usize>From<Mask<i8, N>> forMask<i64, N>

Source§

impl<const N:usize>From<Mask<i8, N>> forMask<isize, N>

Source§

impl<const N:usize>From<Mask<i16, N>> forMask<i8, N>

Source§

impl<const N:usize>From<Mask<i16, N>> forMask<i32, N>

Source§

impl<const N:usize>From<Mask<i16, N>> forMask<i64, N>

Source§

impl<const N:usize>From<Mask<i16, N>> forMask<isize, N>

Source§

impl<const N:usize>From<Mask<i32, N>> forMask<i8, N>

Source§

impl<const N:usize>From<Mask<i32, N>> forMask<i16, N>

Source§

impl<const N:usize>From<Mask<i32, N>> forMask<i64, N>

Source§

impl<const N:usize>From<Mask<i32, N>> forMask<isize, N>

Source§

impl<const N:usize>From<Mask<i64, N>> forMask<i8, N>

Source§

impl<const N:usize>From<Mask<i64, N>> forMask<i16, N>

Source§

impl<const N:usize>From<Mask<i64, N>> forMask<i32, N>

Source§

impl<const N:usize>From<Mask<i64, N>> forMask<isize, N>

Source§

impl<const N:usize>From<Mask<isize, N>> forMask<i8, N>

Source§

impl<const N:usize>From<Mask<isize, N>> forMask<i16, N>

Source§

impl<const N:usize>From<Mask<isize, N>> forMask<i32, N>

Source§

impl<const N:usize>From<Mask<isize, N>> forMask<i64, N>


[8]ページ先頭

©2009-2025 Movatter.jp