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

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

Required Methods§

source

fn try_into(&self) -> Result<&T, PyDowncastError<'_>>

Cast from PyObject to a concrete Python object type.

source

fn try_into_exact(&self) -> Result<&T, PyDowncastError<'_>>

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

Implementors§

source§

impl<U> PyTryInto<U> for PyAnywhere U: for<'v> PyTryFrom<'v>,