Trait pyo3::conversion::PyTryInto
source · pub trait PyTryInto<T>: Sized {
// Required methods
fn try_into(&self) -> Result<&T, PyDowncastError<'_>>;
fn try_into_exact(&self) -> Result<&T, PyDowncastError<'_>>;
}
👎Deprecated since 0.21.0
Expand description
Trait implemented by Python object types that allow a checked downcast.
This trait is similar to std::convert::TryInto
Required Methods§
sourcefn try_into(&self) -> Result<&T, PyDowncastError<'_>>
fn try_into(&self) -> Result<&T, PyDowncastError<'_>>
👎Deprecated since 0.21.0: use
value.downcast()
instead of value.try_into()
Cast from PyObject to a concrete Python object type.
sourcefn try_into_exact(&self) -> Result<&T, PyDowncastError<'_>>
fn try_into_exact(&self) -> Result<&T, PyDowncastError<'_>>
👎Deprecated since 0.21.0: use
value.downcast()
instead of value.try_into_exact()
Cast from PyObject to a concrete Python object type. With exact type check.
Object Safety§
This trait is not object safe.