[−][src]Trait pyo3::PyTryFrom
Trait implemented by Python object types that allow a checked downcast.
This trait is similar to std::convert::TryFrom
Required methods
fn try_from<V: Into<&'v PyAny>>(value: V) -> Result<&'v Self, PyDowncastError>
Cast from a concrete Python object type to PyObject.
fn try_from_exact<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v Self, PyDowncastError>
value: V
) -> Result<&'v Self, PyDowncastError>
Cast from a concrete Python object type to PyObject. With exact type check.
fn try_from_mut<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v mut Self, PyDowncastError>
value: V
) -> Result<&'v mut Self, PyDowncastError>
Cast from a concrete Python object type to PyObject.
fn try_from_mut_exact<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v mut Self, PyDowncastError>
value: V
) -> Result<&'v mut Self, PyDowncastError>
Cast from a concrete Python object type to PyObject. With exact type check.
unsafe fn try_from_unchecked<V: Into<&'v PyAny>>(value: V) -> &'v Self
Cast a PyAny to a specific type of PyObject. The caller must have already verified the reference is for this type.
unsafe fn try_from_mut_unchecked<V: Into<&'v PyAny>>(value: V) -> &'v mut Self
Cast a PyAny to a specific type of PyObject. The caller must have already verified the reference is for this type.
Implementors
impl<'v> PyTryFrom<'v> for PySequence
[src]
fn try_from<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v PySequence, PyDowncastError>
[src]
value: V
) -> Result<&'v PySequence, PyDowncastError>
fn try_from_exact<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v PySequence, PyDowncastError>
[src]
value: V
) -> Result<&'v PySequence, PyDowncastError>
fn try_from_mut<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v mut PySequence, PyDowncastError>
[src]
value: V
) -> Result<&'v mut PySequence, PyDowncastError>
fn try_from_mut_exact<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v mut PySequence, PyDowncastError>
[src]
value: V
) -> Result<&'v mut PySequence, PyDowncastError>
unsafe fn try_from_unchecked<V: Into<&'v PyAny>>(value: V) -> &'v PySequence
[src]
unsafe fn try_from_mut_unchecked<V: Into<&'v PyAny>>(
value: V
) -> &'v mut PySequence
[src]
value: V
) -> &'v mut PySequence
impl<'v, T> PyTryFrom<'v> for T where
T: PyTypeInfo,
[src]
T: PyTypeInfo,
fn try_from<V: Into<&'v PyAny>>(value: V) -> Result<&'v T, PyDowncastError>
[src]
fn try_from_exact<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v T, PyDowncastError>
[src]
value: V
) -> Result<&'v T, PyDowncastError>
fn try_from_mut<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v mut T, PyDowncastError>
[src]
value: V
) -> Result<&'v mut T, PyDowncastError>
fn try_from_mut_exact<V: Into<&'v PyAny>>(
value: V
) -> Result<&'v mut T, PyDowncastError>
[src]
value: V
) -> Result<&'v mut T, PyDowncastError>