Trait pyo3::PyTryInto [−][src]
pub trait PyTryInto<T>: Sized { type Error; fn try_into(&self) -> Result<&T, Self::Error>; fn try_into_exact(&self) -> Result<&T, Self::Error>; fn try_into_mut(&self) -> Result<&mut T, Self::Error>; fn try_into_mut_exact(&self) -> Result<&mut T, Self::Error>; }
Trait implemented by Python object types that allow a checked downcast.
This trait is similar to std::convert::TryInto
Associated Types
type Error
The type returned in the event of a conversion error.
Required Methods
fn try_into(&self) -> Result<&T, Self::Error>
Cast from PyObject to a concrete Python object type.
fn try_into_exact(&self) -> Result<&T, Self::Error>
Cast from PyObject to a concrete Python object type. With exact type check.
fn try_into_mut(&self) -> Result<&mut T, Self::Error>
Cast from PyObject to a concrete Python object type.
fn try_into_mut_exact(&self) -> Result<&mut T, Self::Error>
Cast from PyObject to a concrete Python object type. With exact type check.
Implementors
impl<U> PyTryInto<U> for PyObjectRef where
U: PyTryFrom, type Error = U::Error;