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

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

    pub trait TryFrom<T> {
        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<usize> for i64 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 2] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 20] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i16> for u64 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 18] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u128> for i8 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 0] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i128> for i32 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u64> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i128> for u16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<isize> for u32 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i32> for u64 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u16> for i16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<usize> for u128 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 14] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 19] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i8> for usize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 26] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i128> for i64 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 25] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 21] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i32> for isize type Error = TryFromIntError;` | [src]

- `impl TryFrom<u16> for u8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i16> for u128 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i64> for u8 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 8] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 2] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u128> for u32 type Error = TryFromIntError;` | [src]

- `impl TryFrom<usize> for u64 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 31] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 12] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 28] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<usize> for u32 type Error = TryFromIntError;` | [src]

- `impl TryFrom<isize> for i32 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 18] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i64> for usize type Error = TryFromIntError;` | [src]

- `impl TryFrom<i128> for i16 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 30] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i32> for u16 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 13] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u64> for i64 type Error = TryFromIntError;` | [src]

- `impl TryFrom<isize> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u8> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u32> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<isize> for u128 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 4] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<usize> for i128 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i64> for isize type Error = TryFromIntError;` | [src]

- `impl TryFrom<i128> for isize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 24] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 4] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<isize> for usize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 1] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i32> for i16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u128> for u8 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 24] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 9] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i64> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i8> for u32 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 29] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 11] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<usize> for i16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u32> for u16 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 16] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i16> for u8 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 7] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<usize> for i32 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 1] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<usize> for u16 type Error = TryFromIntError;` | [src]

- `impl<T, U> TryFrom<U> for T where T: From<U>, type Error = !;` | [src]

- `impl TryFrom<u128> for i64 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u64> for i16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u16> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i16> for u16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u128> for isize type Error = TryFromIntError;` | [src]

- `impl TryFrom<i8> for u8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u128> for u16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i64> for i32 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 6] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 9] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 22] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i128> for usize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 22] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u64> for u16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<usize> for u8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u64> for i32 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u32> for i16 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 31] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i16> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u128> for usize type Error = TryFromIntError;` | [src]

- `impl TryFrom<i16> for u32 type Error = TryFromIntError;` | [src]

- `impl TryFrom<isize> for i64 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 15] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<isize> for u64 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 3] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i8> for u128 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 6] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i128> for i8 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 28] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i128> for u128 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u32> for char type Error = CharTryFromError;` | [src]

- `impl TryFrom<u64> for u32 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 23] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 7] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i32> for u32 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 26] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i32> for u128 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i8> for u64 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i128> for u64 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 27] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 27] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<usize> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i8> for u16 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 32] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u32> for i32 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 15] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i64> for u64 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 5] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 20] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i16> for usize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 30] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 16] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u64> for isize type Error = TryFromIntError;` | [src]

- `impl TryFrom<u128> for i32 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 12] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 25] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u32> for u8 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 21] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i64> for u32 type Error = TryFromIntError;` | [src]

- `impl TryFrom<isize> for i128 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 29] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 14] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 10] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i128> for u8 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 0] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 5] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u32> for usize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 17] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u128> for u64 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i128> for u32 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i32> for u8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u16> for isize type Error = TryFromIntError;` | [src]

- `impl TryFrom<isize> for u16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u128> for i16 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 13] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u64> for u8 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 8] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 10] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i64> for u128 type Error = TryFromIntError;` | [src]

- `impl TryFrom<usize> for isize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 32] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<isize> for u8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u64> for usize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 19] type Error = TryFromSliceError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 3] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<i32> for i8 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i64> for u16 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; 11] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<u128> for i128 type Error = TryFromIntError;` | [src]

- `impl TryFrom<u32> for isize type Error = TryFromIntError;` | [src]

- `impl TryFrom<i64> for i16 type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 23] type Error = TryFromSliceError;` | [src]

- `impl TryFrom<isize> for i16 type Error = TryFromIntError;` | [src]

- `impl TryFrom<i32> for usize type Error = TryFromIntError;` | [src]

- `impl<'a, T> TryFrom<&'a [T]> for &'a [T; 17] type Error = TryFromSliceError;` | [src]

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse 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`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)