pyo3::instance

Trait BoundObject

Source
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>;
}
Expand description

Owned or borrowed gil-bound Python smart pointer

This is implemented for Bound and Borrowed.

Required Associated Types§

Source

type Any: BoundObject<'py, PyAny>

Type erased version of Self

Required Methods§

Source

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

Borrow this smart pointer.

Source

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

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

Source

fn into_any(self) -> Self::Any

Upcast the target type of this smart pointer

Source

fn into_ptr(self) -> *mut PyObject

Turn this smart pointer into a strong reference pointer

Source

fn as_ptr(&self) -> *mut PyObject

Turn this smart pointer into a borrowed reference pointer

Source

fn unbind(self) -> Py<T>

Turn this smart pointer into an owned Py<T>

Implementors§

Source§

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

Source§

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

Source§

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

Source§

type Any = Bound<'py, PyAny>

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here