devela::_dep::pyo3

Trait BoundObject

pub trait BoundObject<'py, T>: Sealed {
    type Any: BoundObject<'py, PyAny>;

    // Required methods
    fn as_borrowed(&self) -> Borrowed<'_, 'py, T>;
    fn into_bound(self) -> Bound<'py, T>;
    fn into_any(self) -> Self::Any;
    fn into_ptr(self) -> *mut PyObject;
    fn as_ptr(&self) -> *mut PyObject;
    fn unbind(self) -> Py<T>;
}
Available on crate features dep_pyo3 and std only.
Expand description

Owned or borrowed gil-bound Python smart pointer

This is implemented for Bound and Borrowed.

Required Associated Types§

type Any: BoundObject<'py, PyAny>

Type erased version of Self

Required Methods§

fn as_borrowed(&self) -> Borrowed<'_, 'py, T>

Borrow this smart pointer.

fn into_bound(self) -> Bound<'py, T>

Turns this smart pointer into an owned [Bound<'py, T>]

fn into_any(self) -> Self::Any

Upcast the target type of this smart pointer

fn into_ptr(self) -> *mut PyObject

Turn this smart pointer into a strong reference pointer

fn as_ptr(&self) -> *mut PyObject

Turn this smart pointer into a borrowed reference pointer

fn unbind(self) -> Py<T>

Turn this smart pointer into an owned Py<T>

Implementors§

§

impl<'a, 'py, T> BoundObject<'py, T> for Borrowed<'a, 'py, T>

§

type Any = Borrowed<'a, 'py, PyAny>

§

impl<'py, T> BoundObject<'py, T> for Bound<'py, T>

§

type Any = Bound<'py, PyAny>