Skip to main content

TryFrom

Trait TryFrom 

1.34.0 (const: unstable) · Source
pub trait TryFrom<T>: Sized {
    type Error;

    // Required method
    fn try_from(value: T) -> Result<Self, Self::Error>;
}
Expand description

Simple and safe type conversions that may fail in a controlled way under some circumstances. It is the reciprocal of TryInto.

This is useful when you are doing a type conversion that may trivially succeed but may also need special handling. For example, there is no way to convert an i64 into an i32 using the From trait, because an i64 may contain a value that an i32 cannot represent and so the conversion would lose data. This might be handled by truncating the i64 to an i32 or by simply returning i32::MAX, or by some other method. The From trait is intended for perfect conversions, so the TryFrom trait informs the programmer when a type conversion could go bad and lets them decide how to handle it.

§Generic Implementations

  • TryFrom<T> for U implies TryInto<U> for T
  • try_from is reflexive, which means that TryFrom<T> for T is implemented and cannot fail – the associated Error type for calling T::try_from() on a value of type T is Infallible. When the ! type is stabilized Infallible and ! will be equivalent.

Prefer using TryInto over TryFrom when specifying trait bounds on a generic function to ensure that types that only implement TryInto can be used as well.

TryFrom<T> can be implemented as follows:

struct GreaterThanZero(i32);

impl TryFrom<i32> for GreaterThanZero {
    type Error = &'static str;

    fn try_from(value: i32) -> Result<Self, Self::Error> {
        if value <= 0 {
            Err("GreaterThanZero only accepts values greater than zero!")
        } else {
            Ok(GreaterThanZero(value))
        }
    }
}

§Examples

As described, i32 implements TryFrom<i64>:

let big_number = 1_000_000_000_000i64;
// Silently truncates `big_number`, requires detecting
// and handling the truncation after the fact.
let smaller_number = big_number as i32;
assert_eq!(smaller_number, -727379968);

// Returns an error because `big_number` is too big to
// fit in an `i32`.
let try_smaller_number = i32::try_from(big_number);
assert!(try_smaller_number.is_err());

// Returns `Ok(3)`.
let try_successful_smaller_number = i32::try_from(3);
assert!(try_successful_smaller_number.is_ok());

Required Associated Types§

1.34.0 · Source

type Error

The type returned in the event of a conversion error.

Required Methods§

1.34.0 · Source

fn try_from(value: T) -> Result<Self, Self::Error>

Performs the conversion.

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§

Source§

impl TryFrom<&str> for Alphabet

Source§

impl TryFrom<&str> for regex::regex::bytes::Regex

Source§

impl TryFrom<&str> for regex::regex::string::Regex

Source§

impl TryFrom<&SystemTime> for GeneralizedTime

Available on crate feature std only.
Source§

impl TryFrom<&SystemTime> for DateTime

Available on crate feature std only.
Source§

impl TryFrom<&DateTime> for UtcTime

Source§

impl TryFrom<&AffinePoint> for elliptic_curve::public_key::PublicKey<Secp256k1>

Source§

impl TryFrom<&ProjectivePoint> for elliptic_curve::public_key::PublicKey<Secp256k1>

Source§

impl TryFrom<&PrivateKeyInfo<'_>> for SecretDocument

Available on crate feature alloc only.
Source§

impl TryFrom<&EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>> for AffinePoint

Source§

impl TryFrom<&EcPrivateKey<'_>> for SecretDocument

Available on crate feature alloc only.
Source§

impl TryFrom<&[u8]> for ObjectIdentifier

Source§

impl TryFrom<&[u8]> for CompressedEdwardsY

Source§

impl TryFrom<&[u8]> for CompressedRistretto

Source§

impl TryFrom<&[u8]> for Document

Source§

impl TryFrom<&[u8]> for SecretDocument

Available on crate feature zeroize only.
Source§

impl TryFrom<&[u8]> for ed25519_dalek::signing::SigningKey

Source§

impl TryFrom<&[u8]> for ed25519_dalek::verifying::VerifyingKey

Source§

impl TryFrom<&[u8]> for ed25519_zebra::signing_key::SigningKey

Source§

impl TryFrom<&[u8]> for VerificationKey

Source§

impl TryFrom<&[u8]> for VerificationKeyBytes

Source§

impl TryFrom<&[u8]> for ed25519::Signature

Source§

impl TryFrom<MultiSignature> for CryptoBytes<subsoil::::core::ecdsa::GenericSignature::{constant#0}, (SignatureTag, CryptoBytes<subsoil::::core::ecdsa::GenericPublic::{constant#0}, (PublicTag, EcdsaTag)>)>

Source§

impl TryFrom<MultiSignature> for CryptoBytes<subsoil::::core::ed25519::Signature::{constant#0}, (SignatureTag, Ed25519Tag)>

Source§

impl TryFrom<MultiSignature> for CryptoBytes<subsoil::::core::sr25519::Signature::{constant#0}, (SignatureTag, Sr25519Tag)>

Source§

impl TryFrom<MultiSigner> for CryptoBytes<subsoil::::core::ecdsa::GenericPublic::{constant#0}, (PublicTag, EcdsaTag)>

Source§

impl TryFrom<MultiSigner> for CryptoBytes<subsoil::::core::ed25519::Public::{constant#0}, (PublicTag, Ed25519Tag)>

Source§

impl TryFrom<Error> for Format

Source§

impl TryFrom<Error> for InvalidFormatDescription

Source§

impl TryFrom<Error> for ComponentRange

Source§

impl TryFrom<Error> for ConversionRange

Source§

impl TryFrom<Error> for DifferentVariant

Source§

impl TryFrom<Error> for InvalidVariant

Source§

impl TryFrom<Format> for Error

Source§

impl TryFrom<Format> for ComponentRange

Source§

impl TryFrom<BorrowedFormatItem<'_>> for Component

Source§

impl TryFrom<OwnedFormatItem> for Component

Source§

impl TryFrom<OwnedFormatItem> for Vec<OwnedFormatItem>

1.59.0 (const: unstable) · Source§

impl TryFrom<char> for u8

Maps a char with a code point from U+0000 to U+00FF (inclusive) to a byte in 0x00..=0xFF with the same value, failing if the code point is greater than U+00FF.

See impl From<u8> for char for details on the encoding.

1.74.0 (const: unstable) · Source§

impl TryFrom<char> for u16

Maps a char with a code point from U+0000 to U+FFFF (inclusive) to a u16 in 0x0000..=0xFFFF with the same value, failing if the code point is greater than U+FFFF.

This corresponds to the UCS-2 encoding, as specified in ISO/IEC 10646:2003.

1.94.0 (const: unstable) · Source§

impl TryFrom<char> for usize

Maps a char with a code point from U+0000 to U+10FFFF (inclusive) to a usize in 0x0000..=0x10FFFF with the same value, failing if the final value is unrepresentable by usize.

Generally speaking, this conversion can be seen as obtaining the character’s corresponding UTF-32 code point to the extent representable by pointer addresses.

1.34.0 (const: unstable) · Source§

impl TryFrom<i8> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<i8> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<i8> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<i8> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<i8> for u64

1.34.0 (const: unstable) · Source§

impl TryFrom<i8> for u128

1.34.0 (const: unstable) · Source§

impl TryFrom<i8> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<i8> for NonZero<i8>

1.34.0 (const: unstable) · Source§

impl TryFrom<i16> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<i16> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<i16> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<i16> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<i16> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<i16> for u64

1.34.0 (const: unstable) · Source§

impl TryFrom<i16> for u128

1.34.0 (const: unstable) · Source§

impl TryFrom<i16> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<i16> for NonZero<i16>

Source§

impl TryFrom<i32> for Parity

Even for 0, Odd for 1, error for anything else

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for isize

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for u64

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for u128

1.34.0 (const: unstable) · Source§

impl TryFrom<i32> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<i32> for NonZero<i32>

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for i32

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for isize

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for u64

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for u128

1.34.0 (const: unstable) · Source§

impl TryFrom<i64> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<i64> for NonZero<i64>

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for i32

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for i64

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for isize

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for u64

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for u128

1.34.0 (const: unstable) · Source§

impl TryFrom<i128> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<i128> for NonZero<i128>

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for i32

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for i64

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for i128

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for u64

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for u128

1.34.0 (const: unstable) · Source§

impl TryFrom<isize> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<isize> for NonZero<isize>

Source§

impl TryFrom<u8> for LogLevelFilter

Source§

impl TryFrom<u8> for RuntimeInterfaceLogLevel

Source§

impl TryFrom<u8> for StateVersion

Source§

impl TryFrom<u8> for der::tag::Tag

Source§

impl TryFrom<u8> for Version

Source§

impl TryFrom<u8> for sec1::point::Tag

Source§

impl TryFrom<u8> for Parity

Even for 0, Odd for 1, error for anything else

Source§

impl TryFrom<u8> for ValueType

Source§

impl TryFrom<u8> for Month

1.34.0 (const: unstable) · Source§

impl TryFrom<u8> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<u8> for i8

1.46.0 (const: unstable) · Source§

impl TryFrom<u8> for NonZero<u8>

Source§

impl TryFrom<u8> for TagNumber

Source§

impl TryFrom<u8> for RecoveryId

1.34.0 (const: unstable) · Source§

impl TryFrom<u16> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<u16> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<u16> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<u16> for isize

1.34.0 (const: unstable) · Source§

impl TryFrom<u16> for u8

1.46.0 (const: unstable) · Source§

impl TryFrom<u16> for NonZero<u16>

Source§

impl TryFrom<u16> for aho_corasick::util::primitives::PatternID

Source§

impl TryFrom<u16> for aho_corasick::util::primitives::StateID

Source§

impl TryFrom<u16> for regex_automata::util::primitives::PatternID

Source§

impl TryFrom<u16> for SmallIndex

Source§

impl TryFrom<u16> for regex_automata::util::primitives::StateID

Source§

impl TryFrom<u32> for HttpError

Source§

impl TryFrom<u32> for HttpRequestStatus

Source§

impl TryFrom<u32> for StorageKind

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for char

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for i32

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for isize

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<u32> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<u32> for NonZero<u32>

Source§

impl TryFrom<u32> for aho_corasick::util::primitives::PatternID

Source§

impl TryFrom<u32> for aho_corasick::util::primitives::StateID

Source§

impl TryFrom<u32> for Length

Source§

impl TryFrom<u32> for regex_automata::util::primitives::PatternID

Source§

impl TryFrom<u32> for SmallIndex

Source§

impl TryFrom<u32> for regex_automata::util::primitives::StateID

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for i32

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for i64

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for isize

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<u64> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<u64> for NonZero<u64>

Source§

impl TryFrom<u64> for aho_corasick::util::primitives::PatternID

Source§

impl TryFrom<u64> for aho_corasick::util::primitives::StateID

Source§

impl TryFrom<u64> for regex_automata::util::primitives::PatternID

Source§

impl TryFrom<u64> for SmallIndex

Source§

impl TryFrom<u64> for regex_automata::util::primitives::StateID

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for bool

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for i32

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for i64

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for i128

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for isize

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for u64

1.34.0 (const: unstable) · Source§

impl TryFrom<u128> for usize

1.46.0 (const: unstable) · Source§

impl TryFrom<u128> for NonZero<u128>

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for i8

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for i16

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for i32

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for i64

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for i128

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for isize

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for u8

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for u16

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for u32

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for u64

1.34.0 (const: unstable) · Source§

impl TryFrom<usize> for u128

1.46.0 (const: unstable) · Source§

impl TryFrom<usize> for NonZero<usize>

Source§

impl TryFrom<usize> for Alignment

Source§

impl TryFrom<usize> for aho_corasick::util::primitives::PatternID

Source§

impl TryFrom<usize> for aho_corasick::util::primitives::StateID

Source§

impl TryFrom<usize> for Length

Source§

impl TryFrom<usize> for regex_automata::util::primitives::PatternID

Source§

impl TryFrom<usize> for SmallIndex

Source§

impl TryFrom<usize> for regex_automata::util::primitives::StateID

Source§

impl TryFrom<ByteString> for String

1.85.0 · Source§

impl TryFrom<CString> for String

Source§

impl TryFrom<Ss58AddressFormat> for Ss58AddressFormatRegistry

Source§

impl TryFrom<U256> for i8

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for i16

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for i32

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for i64

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for i128

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for isize

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for u8

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for u16

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for u32

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for u64

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for u128

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for usize

Source§

type Error = &'static str

Source§

impl TryFrom<U256> for U128

Source§

impl TryFrom<U512> for i8

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for i16

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for i32

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for i64

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for i128

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for isize

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for u8

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for u16

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for u32

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for u64

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for u128

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for usize

Source§

type Error = &'static str

Source§

impl TryFrom<U512> for U256

Source§

impl TryFrom<U512> for U128

Source§

impl TryFrom<BigUint> for u64

Source§

type Error = &'static str

Source§

impl TryFrom<BigUint> for u128

Source§

type Error = &'static str

Source§

impl TryFrom<SystemTime> for GeneralizedTime

Available on crate feature std only.
Source§

impl TryFrom<SystemTime> for DateTime

Available on crate feature std only.
Source§

impl TryFrom<Vec<u8>> for topsoil_core::runtime::app_crypto::ecdsa::AppProofOfPossession

Source§

impl TryFrom<Vec<u8>> for topsoil_core::runtime::app_crypto::ecdsa::AppSignature

Source§

impl TryFrom<Vec<u8>> for topsoil_core::runtime::app_crypto::ed25519::AppProofOfPossession

Source§

impl TryFrom<Vec<u8>> for topsoil_core::runtime::app_crypto::ed25519::AppSignature

Source§

impl TryFrom<Vec<u8>> for topsoil_core::runtime::app_crypto::sr25519::AppProofOfPossession

Source§

impl TryFrom<Vec<u8>> for topsoil_core::runtime::app_crypto::sr25519::AppSignature

1.87.0 · Source§

impl TryFrom<Vec<u8>> for String

Source§

impl TryFrom<Vec<u8>> for Document

Source§

impl TryFrom<Vec<u8>> for SecretDocument

Available on crate feature zeroize only.
Source§

impl TryFrom<Vec<u8>> for subsoil::consensus::beefy::ecdsa_crypto::ProofOfPossession

Source§

impl TryFrom<Vec<u8>> for subsoil::consensus::beefy::ecdsa_crypto::Signature

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i8>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i8>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i8>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i8>> for NonZero<u64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i8>> for NonZero<u128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i8>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i16>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i16>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i16>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i16>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i16>> for NonZero<u64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i16>> for NonZero<u128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i16>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<isize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<u64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<u128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i32>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<i32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<isize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<u64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<u128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i64>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<i32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<i64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<isize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<u64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<u128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<i128>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<i32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<i64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<i128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<u64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<u128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<isize>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u8>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u16>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u16>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u16>> for NonZero<isize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u16>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u32>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u32>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u32>> for NonZero<i32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u32>> for NonZero<isize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u32>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u32>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u32>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<i32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<i64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<isize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u64>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<i32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<i64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<i128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<isize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<u64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<u128>> for NonZero<usize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<i8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<i16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<i32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<i64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<i128>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<isize>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<u8>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<u16>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<u32>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<u64>

1.49.0 (const: unstable) · Source§

impl TryFrom<NonZero<usize>> for NonZero<u128>

Source§

impl TryFrom<NonZero<usize>> for Alignment

Source§

impl TryFrom<Duration> for time::duration::Duration

Source§

impl TryFrom<String> for Ia5String

Source§

impl TryFrom<String> for PrintableString

Source§

impl TryFrom<String> for TeletexString

Source§

impl TryFrom<String> for regex::regex::bytes::Regex

Source§

impl TryFrom<String> for regex::regex::string::Regex

Source§

impl TryFrom<AnyRef<'_>> for bool

Source§

impl TryFrom<AnyRef<'_>> for i8

Source§

impl TryFrom<AnyRef<'_>> for i16

Source§

impl TryFrom<AnyRef<'_>> for i32

Source§

impl TryFrom<AnyRef<'_>> for i64

Source§

impl TryFrom<AnyRef<'_>> for i128

Source§

impl TryFrom<AnyRef<'_>> for u8

Source§

impl TryFrom<AnyRef<'_>> for u16

Source§

impl TryFrom<AnyRef<'_>> for u32

Source§

impl TryFrom<AnyRef<'_>> for u64

Source§

impl TryFrom<AnyRef<'_>> for u128

Source§

impl TryFrom<AnyRef<'_>> for ()

Source§

impl TryFrom<AnyRef<'_>> for ObjectIdentifier

Source§

impl TryFrom<DateTime> for UtcTime

Source§

impl TryFrom<IndefiniteLength> for Length

Source§

impl TryFrom<Length> for usize

Source§

impl TryFrom<VerificationKeyBytes> for VerificationKey

Source§

impl TryFrom<AffinePoint> for elliptic_curve::public_key::PublicKey<Secp256k1>

Source§

impl TryFrom<ProjectivePoint> for elliptic_curve::public_key::PublicKey<Secp256k1>

Source§

impl TryFrom<Affine> for libsecp256k1::PublicKey

Source§

impl TryFrom<Scalar> for libsecp256k1::SecretKey

Source§

impl TryFrom<PrivateKeyInfo<'_>> for SecretDocument

Available on crate feature alloc only.
Source§

impl TryFrom<U128> for i8

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for i16

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for i32

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for i64

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for i128

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for isize

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for u8

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for u16

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for u32

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for u64

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for u128

Source§

type Error = &'static str

Source§

impl TryFrom<U128> for usize

Source§

type Error = &'static str

Source§

impl TryFrom<EncodedPoint<<Secp256k1 as Curve>::FieldBytesSize>> for AffinePoint

Source§

impl TryFrom<EcPrivateKey<'_>> for SecretDocument

Available on crate feature alloc only.
Source§

impl TryFrom<SerializedSignature> for secp256k1::ecdsa::Signature

Source§

impl TryFrom<Duration> for topsoil_core::runtime::std::time::Duration

Source§

impl TryFrom<[u8; 32]> for VerificationKey

Source§

impl<'__der> TryFrom<&'__der Any> for BitString

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for GeneralizedTime

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for Ia5String

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for Int

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for Uint

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for Null

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for OctetString

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for PrintableString

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for TeletexString

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<&'__der Any> for UtcTime

Available on crate feature alloc only.
Source§

impl<'__der> TryFrom<AnyRef<'__der>> for BitString

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for GeneralizedTime

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for Ia5String

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for Int

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for Uint

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for Null

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for OctetString

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for PrintableString

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for TeletexString

Source§

impl<'__der> TryFrom<AnyRef<'__der>> for UtcTime

Source§

impl<'__der, 'a> TryFrom<&'__der Any> for BitStringRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<&'__der Any> for Ia5StringRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<&'__der Any> for IntRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<&'__der Any> for UintRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<&'__der Any> for OctetStringRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<&'__der Any> for PrintableStringRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<&'__der Any> for TeletexStringRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<&'__der Any> for Utf8StringRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<&'__der Any> for VideotexStringRef<'a>
where '__der: 'a,

Available on crate feature alloc only.
Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for BitStringRef<'a>
where '__der: 'a,

Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for Ia5StringRef<'a>
where '__der: 'a,

Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for IntRef<'a>
where '__der: 'a,

Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for UintRef<'a>
where '__der: 'a,

Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for OctetStringRef<'a>
where '__der: 'a,

Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for PrintableStringRef<'a>
where '__der: 'a,

Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for TeletexStringRef<'a>
where '__der: 'a,

Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for Utf8StringRef<'a>
where '__der: 'a,

Source§

impl<'__der, 'a> TryFrom<AnyRef<'__der>> for VideotexStringRef<'a>
where '__der: 'a,

Source§

impl<'a> TryFrom<&&'a [u8]> for BitStringRef<'a>

Hack for simplifying the custom derive use case.

Source§

impl<'a> TryFrom<&'a str> for Ss58AddressFormatRegistry

Source§

impl<'a> TryFrom<&'a str> for Ss58AddressFormat

Source§

impl<'a> TryFrom<&'a str> for KeyTypeId

Source§

impl<'a> TryFrom<&'a ByteStr> for &'a str

Source§

impl<'a> TryFrom<&'a ByteStr> for String

Source§

impl<'a> TryFrom<&'a ByteString> for &'a str

Source§

impl<'a> TryFrom<&'a U512> for U256

1.72.0 · Source§

impl<'a> TryFrom<&'a OsStr> for &'a str

Source§

impl<'a> TryFrom<&'a SerializedSignature> for secp256k1::ecdsa::Signature

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::ecdsa::AppProofOfPossession

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::ecdsa::AppPublic

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::ecdsa::AppSignature

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::ed25519::AppProofOfPossession

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::ed25519::AppPublic

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::ed25519::AppSignature

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::sr25519::AppProofOfPossession

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::sr25519::AppPublic

Source§

impl<'a> TryFrom<&'a [u8]> for topsoil_core::runtime::app_crypto::sr25519::AppSignature

Source§

impl<'a> TryFrom<&'a [u8]> for AccountId32

Source§

impl<'a> TryFrom<&'a [u8]> for AnyRef<'a>

Source§

impl<'a> TryFrom<&'a [u8]> for BitStringRef<'a>

Source§

impl<'a> TryFrom<&'a [u8]> for PrivateKeyInfo<'a>

Source§

impl<'a> TryFrom<&'a [u8]> for EcPrivateKey<'a>

Source§

impl<'a> TryFrom<&'a [u8]> for subsoil::consensus::beefy::ecdsa_crypto::ProofOfPossession

Source§

impl<'a> TryFrom<&'a [u8]> for subsoil::consensus::beefy::ecdsa_crypto::Public

Source§

impl<'a> TryFrom<&'a [u8]> for subsoil::consensus::beefy::ecdsa_crypto::Signature

Source§

impl<'a> TryFrom<&'a mut ByteStr> for &'a mut str

Source§

impl<'a> TryFrom<BorrowedFormatItem<'a>> for &[BorrowedFormatItem<'a>]

Source§

impl<'a> TryFrom<AnyRef<'a>> for &'a str

Source§

impl<'a> TryFrom<AnyRef<'a>> for SystemTime

Available on crate feature std only.
Source§

impl<'a> TryFrom<AnyRef<'a>> for String

Available on crate feature alloc only.
Source§

impl<'a> TryFrom<BitStringRef<'a>> for &'a [u8]

Source§

impl<'a> TryFrom<Item<'a>> for BorrowedFormatItem<'a>

Source§

type Error = Error

Source§

impl<'a, 'k, Params, Key> TryFrom<&SubjectPublicKeyInfo<Params, Key>> for Document
where 'a: 'k, Key: 'k + Decode<'a> + Encode + FixedTag, Params: Choice<'a> + Encode, BitStringRef<'a>: From<&'k Key>,

Available on crate feature alloc only.
Source§

impl<'a, 'k, Params, Key> TryFrom<SubjectPublicKeyInfo<Params, Key>> for Document
where 'a: 'k, Key: 'k + Decode<'a> + Encode + FixedTag, Params: Choice<'a> + Encode, BitStringRef<'a>: From<&'k Key>,

Available on crate feature alloc only.
Source§

impl<'a, HO> TryFrom<NodeHandle<'a>> for ChildReference<HO>
where HO: AsRef<[u8]> + AsMut<[u8]> + Default + Clone + Copy,

Source§

impl<'a, Params> TryFrom<&'a [u8]> for AlgorithmIdentifier<Params>
where Params: Choice<'a> + Encode,

Source§

impl<'a, Params, Key> TryFrom<&'a [u8]> for SubjectPublicKeyInfo<Params, Key>
where Params: Choice<'a> + Encode, Key: Decode<'a> + Encode + FixedTag,

Source§

impl<'a, T> TryFrom<AnyRef<'a>> for ContextSpecific<T>
where T: Decode<'a>,

Source§

impl<'a, T, S> TryFrom<&'a [T]> for BoundedSlice<'a, T, S>
where S: Get<u32>,

Source§

type Error = &'a [T]

1.34.0 (const: unstable) · Source§

impl<'a, T, const N: usize> TryFrom<&'a [T]> for &'a [T; N]

Tries to create an array ref &[T; N] from a slice ref &[T]. Succeeds if slice.len() == N.

let bytes: [u8; 3] = [1, 0, 2];

let bytes_head: &[u8; 2] = <&[u8; 2]>::try_from(&bytes[0..2]).unwrap();
assert_eq!(1, u16::from_le_bytes(*bytes_head));

let bytes_tail: &[u8; 2] = bytes[1..3].try_into().unwrap();
assert_eq!(512, u16::from_le_bytes(*bytes_tail));
1.34.0 (const: unstable) · Source§

impl<'a, T, const N: usize> TryFrom<&'a mut [T]> for &'a mut [T; N]

Tries to create a mutable array ref &mut [T; N] from a mutable slice ref &mut [T]. Succeeds if slice.len() == N.

let mut bytes: [u8; 3] = [1, 0, 2];

let bytes_head: &mut [u8; 2] = <&mut [u8; 2]>::try_from(&mut bytes[0..2]).unwrap();
assert_eq!(1, u16::from_le_bytes(*bytes_head));

let bytes_tail: &mut [u8; 2] = (&mut bytes[1..3]).try_into().unwrap();
assert_eq!(512, u16::from_le_bytes(*bytes_tail));
Source§

impl<'a, const CAP: usize> TryFrom<&'a str> for ArrayString<CAP>

Source§

impl<'a, const CAP: usize> TryFrom<Arguments<'a>> for ArrayString<CAP>

Source§

impl<C> TryFrom<&GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>> for elliptic_curve::public_key::PublicKey<C>

Available on crate feature sec1 only.
Source§

impl<C> TryFrom<&EncodedPoint<<C as Curve>::FieldBytesSize>> for elliptic_curve::public_key::PublicKey<C>

Available on crate feature sec1 only.
Source§

impl<C> TryFrom<&SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>> for elliptic_curve::public_key::PublicKey<C>

Available on crate feature pkcs8 only.
Source§

impl<C> TryFrom<&[u8]> for ecdsa::der::Signature<C>

Source§

impl<C> TryFrom<&[u8]> for ecdsa::signing::SigningKey<C>

Source§

impl<C> TryFrom<&[u8]> for ecdsa::Signature<C>

Source§

impl<C> TryFrom<&[u8]> for SignatureWithOid<C>

Available on crate features digest and hazmat only.

NOTE: this implementation assumes the default digest for the given elliptic curve as defined by hazmat::DigestPrimitive.

When working with alternative digests, you will need to use e.g. SignatureWithOid::new_with_digest.

Source§

impl<C> TryFrom<&[u8]> for ecdsa::verifying::VerifyingKey<C>

Source§

impl<C> TryFrom<&[u8]> for NonZeroScalar<C>
where C: CurveArithmetic,

Source§

impl<C> TryFrom<Signature<C>> for ecdsa::Signature<C>

Source§

impl<C> TryFrom<GenericArray<u8, <<C as Curve>::FieldBytesSize as ModulusSize>::CompressedPointSize>> for elliptic_curve::public_key::PublicKey<C>

Available on crate feature sec1 only.
Source§

impl<C> TryFrom<PrivateKeyInfo<'_>> for elliptic_curve::secret_key::SecretKey<C>

Source§

impl<C> TryFrom<EncodedPoint<<C as Curve>::FieldBytesSize>> for elliptic_curve::public_key::PublicKey<C>

Available on crate feature sec1 only.
Source§

impl<C> TryFrom<EcPrivateKey<'_>> for elliptic_curve::secret_key::SecretKey<C>

Available on crate feature sec1 only.
Source§

impl<C> TryFrom<SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>> for elliptic_curve::public_key::PublicKey<C>

Available on crate feature pkcs8 only.
Source§

impl<D> TryFrom<u16> for TypeWithDefault<u8, D>
where D: Get<u8>,

Source§

impl<D> TryFrom<u32> for TypeWithDefault<u8, D>
where D: Get<u8>,

Source§

impl<D> TryFrom<u32> for TypeWithDefault<u16, D>
where D: Get<u16>,

Source§

impl<D> TryFrom<u64> for TypeWithDefault<u8, D>
where D: Get<u8>,

Source§

impl<D> TryFrom<u64> for TypeWithDefault<u16, D>
where D: Get<u16>,

Source§

impl<D> TryFrom<u64> for TypeWithDefault<u32, D>
where D: Get<u32>,

Source§

impl<D> TryFrom<u128> for TypeWithDefault<u8, D>
where D: Get<u8>,

Source§

impl<D> TryFrom<u128> for TypeWithDefault<u16, D>
where D: Get<u16>,

Source§

impl<D> TryFrom<u128> for TypeWithDefault<u32, D>
where D: Get<u32>,

Source§

impl<D> TryFrom<u128> for TypeWithDefault<u64, D>
where D: Get<u64>,

Source§

impl<K, V, S> TryFrom<BTreeMap<K, V>> for BoundedBTreeMap<K, V, S>
where K: Ord, S: Get<u32>,

Source§

impl<O> TryFrom<i32> for I16<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<i64> for I16<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<i64> for I32<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<i128> for I16<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<i128> for I32<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<i128> for I64<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<isize> for I16<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<u32> for U16<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<u64> for U16<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<u64> for U32<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<u128> for U16<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<u128> for U32<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<u128> for U64<O>
where O: ByteOrder,

Source§

impl<O> TryFrom<usize> for U16<O>
where O: ByteOrder,

Source§

impl<O, P> TryFrom<I32<P>> for I16<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<I64<P>> for I16<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<I64<P>> for I32<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<I128<P>> for I16<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<I128<P>> for I32<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<I128<P>> for I64<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<Isize<P>> for I16<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<U32<P>> for U16<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<U64<P>> for U16<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<U64<P>> for U32<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<U128<P>> for U16<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<U128<P>> for U32<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<U128<P>> for U64<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<O, P> TryFrom<Usize<P>> for U16<O>
where O: ByteOrder, P: ByteOrder,

Source§

impl<Size> TryFrom<&[u8]> for EncodedPoint<Size>
where Size: ModulusSize,

Source§

impl<T> TryFrom<Vec<T>> for SetOfVec<T>
where T: DerOrd,

Available on crate feature alloc only.
Source§

impl<T, A> TryFrom<&[T]> for tinyvec::arrayvec::ArrayVec<A>
where T: Clone + Default, A: Array<Item = T>,

1.48.0 · Source§

impl<T, A, const N: usize> TryFrom<Vec<T, A>> for [T; N]
where A: Allocator,

Source§

type Error = Vec<T, A>

1.43.0 · Source§

impl<T, A, const N: usize> TryFrom<Rc<[T], A>> for Rc<[T; N], A>
where A: Allocator,

Source§

type Error = Rc<[T], A>

1.43.0 · Source§

impl<T, A, const N: usize> TryFrom<Arc<[T], A>> for Arc<[T; N], A>
where A: Allocator,

Source§

type Error = Arc<[T], A>

Source§

impl<T, A, const N: usize> TryFrom<Box<[T], A>> for allocator_api2::stable::boxed::Box<[T; N], A>
where A: Allocator,

Source§

type Error = Box<[T], A>

Source§

impl<T, A, const N: usize> TryFrom<Vec<T, A>> for [T; N]
where A: Allocator,

Source§

type Error = Vec<T, A>

Source§

impl<T, D> TryFrom<usize> for TypeWithDefault<T, D>
where T: TryFrom<usize>, D: Get<T>,

Source§

impl<T, D> TryFrom<TypeWithDefault<T, D>> for u8
where T: TryInto<u8>, D: Get<T>,

Source§

type Error = <T as TryInto<u8>>::Error

Source§

impl<T, D> TryFrom<TypeWithDefault<T, D>> for u16
where T: TryInto<u16>, D: Get<T>,

Source§

type Error = <T as TryInto<u16>>::Error

Source§

impl<T, D> TryFrom<TypeWithDefault<T, D>> for u32
where T: TryInto<u32>, D: Get<T>,

Source§

type Error = <T as TryInto<u32>>::Error

Source§

impl<T, D> TryFrom<TypeWithDefault<T, D>> for u64
where T: TryInto<u64>, D: Get<T>,

Source§

type Error = <T as TryInto<u64>>::Error

Source§

impl<T, D> TryFrom<TypeWithDefault<T, D>> for u128
where T: TryInto<u128>, D: Get<T>,

Source§

impl<T, D> TryFrom<TypeWithDefault<T, D>> for usize
where T: TryInto<usize>, D: Get<T>,

Source§

impl<T, S> TryFrom<Vec<T>> for BoundedVec<T, S>
where S: Get<u32>,

Source§

type Error = Vec<T>

Source§

impl<T, S> TryFrom<Vec<T>> for WeakBoundedVec<T, S>
where S: Get<u32>,

Source§

impl<T, S> TryFrom<BTreeSet<T>> for BoundedBTreeSet<T, S>
where T: Ord, S: Get<u32>,

1.34.0 (const: unstable) · Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

impl<T, const CAP: usize> TryFrom<&[T]> for arrayvec::arrayvec::ArrayVec<T, CAP>
where T: Clone,

Try to create an ArrayVec from a slice. This will return an error if the slice was too big to fit.

use arrayvec::ArrayVec;
use std::convert::TryInto as _;

let array: ArrayVec<_, 4> = (&[1, 2, 3] as &[_]).try_into().unwrap();
assert_eq!(array.len(), 3);
assert_eq!(array.capacity(), 4);
1.34.0 (const: unstable) · Source§

impl<T, const N: usize> TryFrom<&[T]> for [T; N]
where T: Copy,

Tries to create an array [T; N] by copying from a slice &[T]. Succeeds if slice.len() == N.

let bytes: [u8; 3] = [1, 0, 2];

let bytes_head: [u8; 2] = <[u8; 2]>::try_from(&bytes[0..2]).unwrap();
assert_eq!(1, u16::from_le_bytes(bytes_head));

let bytes_tail: [u8; 2] = bytes[1..3].try_into().unwrap();
assert_eq!(512, u16::from_le_bytes(bytes_tail));
Source§

impl<T, const N: usize> TryFrom<&[T]> for Simd<T, N>
where T: SimdElement,

1.59.0 (const: unstable) · Source§

impl<T, const N: usize> TryFrom<&mut [T]> for [T; N]
where T: Copy,

Tries to create an array [T; N] by copying from a mutable slice &mut [T]. Succeeds if slice.len() == N.

let mut bytes: [u8; 3] = [1, 0, 2];

let bytes_head: [u8; 2] = <[u8; 2]>::try_from(&mut bytes[0..2]).unwrap();
assert_eq!(1, u16::from_le_bytes(bytes_head));

let bytes_tail: [u8; 2] = (&mut bytes[1..3]).try_into().unwrap();
assert_eq!(512, u16::from_le_bytes(bytes_tail));
Source§

impl<T, const N: usize> TryFrom<&mut [T]> for Simd<T, N>
where T: SimdElement,

Source§

impl<T, const N: usize> TryFrom<[T; N]> for SetOf<T, N>
where T: DerOrd,

Source§

impl<T, const N: usize> TryFrom<[T; N]> for SetOfVec<T>
where T: DerOrd,

Available on crate feature alloc only.
1.66.0 · Source§

impl<T, const N: usize> TryFrom<Vec<T>> for topsoil_core::runtime::std::prelude::Box<[T; N]>

Available on non-no_global_oom_handling only.
Source§

type Error = Vec<T>

1.43.0 · Source§

impl<T, const N: usize> TryFrom<Box<[T]>> for topsoil_core::runtime::std::prelude::Box<[T; N]>

Source§

impl<const MIN: i8, const MAX: i8> TryFrom<i8> for RangedI8<MIN, MAX>

Source§

impl<const MIN: i16, const MAX: i16> TryFrom<i16> for RangedI16<MIN, MAX>

Source§

impl<const MIN: i32, const MAX: i32> TryFrom<i32> for RangedI32<MIN, MAX>

Source§

impl<const MIN: i64, const MAX: i64> TryFrom<i64> for RangedI64<MIN, MAX>

Source§

impl<const MIN: i128, const MAX: i128> TryFrom<i128> for RangedI128<MIN, MAX>

Source§

impl<const MIN: isize, const MAX: isize> TryFrom<isize> for RangedIsize<MIN, MAX>

Source§

impl<const MIN: u8, const MAX: u8> TryFrom<u8> for RangedU8<MIN, MAX>

Source§

impl<const MIN: u16, const MAX: u16> TryFrom<u16> for RangedU16<MIN, MAX>

Source§

impl<const MIN: u32, const MAX: u32> TryFrom<u32> for RangedU32<MIN, MAX>

Source§

impl<const MIN: u64, const MAX: u64> TryFrom<u64> for RangedU64<MIN, MAX>

Source§

impl<const MIN: u128, const MAX: u128> TryFrom<u128> for RangedU128<MIN, MAX>

Source§

impl<const MIN: usize, const MAX: usize> TryFrom<usize> for RangedUsize<MIN, MAX>

Source§

impl<const N: usize, T> TryFrom<&[u8]> for CryptoBytes<N, T>