pub trait IntoPyObjectExt<'py>: IntoPyObject<'py> + Sealed {
// Provided methods
fn into_bound_py_any(self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> { ... }
fn into_py_any(self, py: Python<'py>) -> PyResult<Py<PyAny>> { ... }
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> PyResult<Self::Output> { ... }
}Expand description
Convenience methods for common usages of IntoPyObject. Every type that implements
IntoPyObject also implements this trait.
These methods:
- Drop type information from the output, returning a
PyAnyobject. - Always convert the
Errortype toPyErr, which may incur a performance penalty but it more convenient in contexts where the?operator would produce aPyErranyway.
Provided Methods§
Sourcefn into_bound_py_any(self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>>
fn into_bound_py_any(self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>>
Converts self into an owned Python object, dropping type information.
Sourcefn into_py_any(self, py: Python<'py>) -> PyResult<Py<PyAny>>
fn into_py_any(self, py: Python<'py>) -> PyResult<Py<PyAny>>
Converts self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.
Sourcefn into_pyobject_or_pyerr(self, py: Python<'py>) -> PyResult<Self::Output>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> PyResult<Self::Output>
Converts self into a Python object.
This is equivalent to calling into_pyobject followed
with .map_err(Into::into) to convert the error type to PyErr. This is helpful
for generic code which wants to make use of the ? operator.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.