# pyo3::conversion::PyTryInto - Rust
Trait implemented by Python object types that allow a checked downcast. This trait is similar to `std::convert::TryInto`
Keywords: rust, rustlang, rust-lang, PyTryInto

# Trait pyo3::conversion::PyTryInto [−] [src]

    pub trait PyTryInto<T>: Sized {
        fn try_into(&self) -> Result<&T, PyDowncastError<'_>>;
        fn try_into_exact(&self) -> Result<&T, PyDowncastError<'_>>;
    }

Trait implemented by Python object types that allow a checked downcast. This trait is similar to `std::convert::TryInto`

## Required methods

### `fn try_into(&self) -> Result<&T, PyDowncastError<'_>>` [src]

Cast from PyObject to a concrete Python object type.

### `fn try_into_exact(&self) -> Result<&T, PyDowncastError<'_>>` [src]

Cast from PyObject to a concrete Python object type. With exact type check.

Loading content...

## Implementors

### `impl<U> PyTryInto<U> for PyAny where
U: for<'v> PyTryFrom<'v>,` [src]

#### `fn try_into(&self) -> Result<&U, PyDowncastError<'_>>` [src]

#### `fn try_into_exact(&self) -> Result<&U, PyDowncastError<'_>>` [src]

Loading content...