core::convert::TryFrom - Rust
Description: API documentation for the Rust `TryFrom` trait in crate `core`.
Keywords: rust, rustlang, rust-lang, TryFrom

# Trait core::convert::TryFrom [−] [src]

    pub trait TryFrom<T>: Sized {
        type Error;
        fn try_from(value: T) -> Result<Self, Self::Error>;
    }

🔬 This is a nightly-only experimental API. (`try_from` #33417)

Attempt to construct `Self` via a conversion.

## Associated Types

### `type Error`

🔬 This is a nightly-only experimental API. (`try_from` #33417)

The type returned in the event of a conversion error.

## Required Methods

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

🔬 This is a nightly-only experimental API. (`try_from` #33417)

Performs the conversion.

## Implementors

- `impl TryFrom<u8> for u8`
- `impl TryFrom<u16> for u8`
- `impl TryFrom<u32> for u8`
- `impl TryFrom<u64> for u8`
- `impl TryFrom<u128> for u8`
- `impl TryFrom<usize> for u8`
- `impl TryFrom<i8> for i8`
- `impl TryFrom<i16> for i8`
- `impl TryFrom<i32> for i8`
- `impl TryFrom<i64> for i8`
- `impl TryFrom<i128> for i8`
- `impl TryFrom<isize> for i8`
- `impl TryFrom<u8> for u16`
- `impl TryFrom<u16> for u16`
- `impl TryFrom<u32> for u16`
- `impl TryFrom<u64> for u16`
- `impl TryFrom<u128> for u16`
- `impl TryFrom<usize> for u16`
- `impl TryFrom<i8> for i16`
- `impl TryFrom<i16> for i16`
- `impl TryFrom<i32> for i16`
- `impl TryFrom<i64> for i16`
- `impl TryFrom<i128> for i16`
- `impl TryFrom<isize> for i16`
- `impl TryFrom<u8> for u32`
- `impl TryFrom<u16> for u32`
- `impl TryFrom<u32> for u32`
- `impl TryFrom<u64> for u32`
- `impl TryFrom<u128> for u32`
- `impl TryFrom<usize> for u32`
- `impl TryFrom<i8> for i32`
- `impl TryFrom<i16> for i32`
- `impl TryFrom<i32> for i32`
- `impl TryFrom<i64> for i32`
- `impl TryFrom<i128> for i32`
- `impl TryFrom<isize> for i32`
- `impl TryFrom<u8> for u64`
- `impl TryFrom<u16> for u64`
- `impl TryFrom<u32> for u64`
- `impl TryFrom<u64> for u64`
- `impl TryFrom<u128> for u64`
- `impl TryFrom<usize> for u64`
- `impl TryFrom<i8> for i64`
- `impl TryFrom<i16> for i64`
- `impl TryFrom<i32> for i64`
- `impl TryFrom<i64> for i64`
- `impl TryFrom<i128> for i64`
- `impl TryFrom<isize> for i64`
- `impl TryFrom<u8> for u128`
- `impl TryFrom<u16> for u128`
- `impl TryFrom<u32> for u128`
- `impl TryFrom<u64> for u128`
- `impl TryFrom<u128> for u128`
- `impl TryFrom<usize> for u128`
- `impl TryFrom<i8> for i128`
- `impl TryFrom<i16> for i128`
- `impl TryFrom<i32> for i128`
- `impl TryFrom<i64> for i128`
- `impl TryFrom<i128> for i128`
- `impl TryFrom<isize> for i128`
- `impl TryFrom<u8> for usize`
- `impl TryFrom<u16> for usize`
- `impl TryFrom<u32> for usize`
- `impl TryFrom<u64> for usize`
- `impl TryFrom<u128> for usize`
- `impl TryFrom<usize> for usize`
- `impl TryFrom<i8> for isize`
- `impl TryFrom<i16> for isize`
- `impl TryFrom<i32> for isize`
- `impl TryFrom<i64> for isize`
- `impl TryFrom<i128> for isize`
- `impl TryFrom<isize> for isize`
- `impl TryFrom<u8> for i8`
- `impl TryFrom<i8> for u8`
- `impl TryFrom<u8> for i16`
- `impl TryFrom<i16> for u8`
- `impl TryFrom<u8> for i32`
- `impl TryFrom<i32> for u8`
- `impl TryFrom<u8> for i64`
- `impl TryFrom<i64> for u8`
- `impl TryFrom<u8> for i128`
- `impl TryFrom<i128> for u8`
- `impl TryFrom<u8> for isize`
- `impl TryFrom<isize> for u8`
- `impl TryFrom<u16> for i8`
- `impl TryFrom<i8> for u16`
- `impl TryFrom<u16> for i16`
- `impl TryFrom<i16> for u16`
- `impl TryFrom<u16> for i32`
- `impl TryFrom<i32> for u16`
- `impl TryFrom<u16> for i64`
- `impl TryFrom<i64> for u16`
- `impl TryFrom<u16> for i128`
- `impl TryFrom<i128> for u16`
- `impl TryFrom<u16> for isize`
- `impl TryFrom<isize> for u16`
- `impl TryFrom<u32> for i8`
- `impl TryFrom<i8> for u32`
- `impl TryFrom<u32> for i16`
- `impl TryFrom<i16> for u32`
- `impl TryFrom<u32> for i32`
- `impl TryFrom<i32> for u32`
- `impl TryFrom<u32> for i64`
- `impl TryFrom<i64> for u32`
- `impl TryFrom<u32> for i128`
- `impl TryFrom<i128> for u32`
- `impl TryFrom<u32> for isize`
- `impl TryFrom<isize> for u32`
- `impl TryFrom<u64> for i8`
- `impl TryFrom<i8> for u64`
- `impl TryFrom<u64> for i16`
- `impl TryFrom<i16> for u64`
- `impl TryFrom<u64> for i32`
- `impl TryFrom<i32> for u64`
- `impl TryFrom<u64> for i64`
- `impl TryFrom<i64> for u64`
- `impl TryFrom<u64> for i128`
- `impl TryFrom<i128> for u64`
- `impl TryFrom<u64> for isize`
- `impl TryFrom<isize> for u64`
- `impl TryFrom<u128> for i8`
- `impl TryFrom<i8> for u128`
- `impl TryFrom<u128> for i16`
- `impl TryFrom<i16> for u128`
- `impl TryFrom<u128> for i32`
- `impl TryFrom<i32> for u128`
- `impl TryFrom<u128> for i64`
- `impl TryFrom<i64> for u128`
- `impl TryFrom<u128> for i128`
- `impl TryFrom<i128> for u128`
- `impl TryFrom<u128> for isize`
- `impl TryFrom<isize> for u128`
- `impl TryFrom<usize> for i8`
- `impl TryFrom<i8> for usize`
- `impl TryFrom<usize> for i16`
- `impl TryFrom<i16> for usize`
- `impl TryFrom<usize> for i32`
- `impl TryFrom<i32> for usize`
- `impl TryFrom<usize> for i64`
- `impl TryFrom<i64> for usize`
- `impl TryFrom<usize> for i128`
- `impl TryFrom<i128> for usize`
- `impl TryFrom<usize> for isize`
- `impl TryFrom<isize> for usize`
- `impl<'a, T> TryFrom<&'a str> for T where
  T: FromStr,`
- `impl TryFrom<u32> for char`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)