Module pyo3::conversion
source · [−]Expand description
Defines conversions between Rust and Python types.
Traits
This trait represents that we can do zero-cost conversion from the object to a FFI pointer.
FromPyObject
is implemented by various types that can be extracted from
a Python object reference.
Raw level conversion between *mut ffi::PyObject
and PyO3 types.
Defines a conversion from a Rust type to a Python object.
This trait allows retrieving the underlying FFI pointer from Python objects.
Trait implemented by Python object types that allow a checked downcast.
If T
implements PyTryFrom
, we can convert &PyAny
to &T
.
Trait implemented by Python object types that allow a checked downcast.
This trait is similar to std::convert::TryInto
This trait has two implementations: The slow one is implemented for all ToPyObject and creates a new object using ToPyObject::to_object, while the fast one is only implemented for AsPyPointer (we know that every AsPyPointer is also ToPyObject) and uses AsPyPointer::as_ptr()
Conversion trait that allows various objects to be converted into PyObject
.