Skip to main content

TryIntoPyObjectUnsafe

Trait TryIntoPyObjectUnsafe 

Source
pub trait TryIntoPyObjectUnsafe<'py, P> {
    // Required method
    unsafe fn try_to_object_unsafe(
        self,
        py: Python<'py>,
    ) -> PyResult<Bound<'py, P>>;
}
Expand description

A variant of pyo3::IntoPyObject used to wrap unsafe impls and propagates the unsafety to the caller.

Required Methods§

Source

unsafe fn try_to_object_unsafe(self, py: Python<'py>) -> PyResult<Bound<'py, P>>

§Safety

The caller must ensure self is valid for the duration of the call and that the type-erased pointer invariants of the trait are upheld.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, 'py, K, V> TryIntoPyObjectUnsafe<'py, PyDict> for &'a HashMap<K, V>
where &'a K: IntoPyObject<'py> + Eq + Hash, &'a V: TryIntoPyObjectUnsafe<'py, PyAny>, K: 'a, V: 'a,

Helper impl for casting into kwargs for python functions calls.

Source§

unsafe fn try_to_object_unsafe( self, py: Python<'py>, ) -> PyResult<Bound<'py, PyDict>>

Source§

impl<'a, 'py, T> TryIntoPyObjectUnsafe<'py, PyTuple> for &'a Vec<T>
where &'a T: TryIntoPyObjectUnsafe<'py, PyAny>, T: 'a,

Helper impl for casting into args for python functions calls.

Source§

unsafe fn try_to_object_unsafe( self, py: Python<'py>, ) -> PyResult<Bound<'py, PyTuple>>

Implementors§

Source§

impl<'a, 'py, T> TryIntoPyObjectUnsafe<'py, PyAny> for &'a PyTree<T>
where &'a T: TryIntoPyObjectUnsafe<'py, PyAny>, T: 'a,

Serialize into a PyObject.