Trait pyo3::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 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 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>