[][src]Trait pyo3::AsPyRef

pub trait AsPyRef<T: PyTypeInfo>: Sized {
    fn as_ref(&self, py: Python) -> PyRef<T>;
fn as_mut(&mut self, py: Python) -> PyRefMut<T>; fn with<F, R>(&self, f: F) -> R
    where
        F: FnOnce(Python, PyRef<T>) -> R
, { ... }
fn with_mut<F, R>(&mut self, f: F) -> R
    where
        F: FnOnce(Python, PyRefMut<T>) -> R
, { ... }
fn into_py<F, R>(self, f: F) -> R
    where
        Self: IntoPyPointer,
        F: FnOnce(Python, PyRef<T>) -> R
, { ... }
fn into_mut_py<F, R>(self, f: F) -> R
    where
        Self: IntoPyPointer,
        F: FnOnce(Python, PyRefMut<T>) -> R
, { ... } }

Trait implements object reference extraction from python managed pointer.

Required methods

fn as_ref(&self, py: Python) -> PyRef<T>

Return reference to object.

fn as_mut(&mut self, py: Python) -> PyRefMut<T>

Return mutable reference to object.

Loading content...

Provided methods

fn with<F, R>(&self, f: F) -> R where
    F: FnOnce(Python, PyRef<T>) -> R, 

Acquire python gil and call closure with object reference.

fn with_mut<F, R>(&mut self, f: F) -> R where
    F: FnOnce(Python, PyRefMut<T>) -> R, 

Acquire python gil and call closure with mutable object reference.

fn into_py<F, R>(self, f: F) -> R where
    Self: IntoPyPointer,
    F: FnOnce(Python, PyRef<T>) -> R, 

fn into_mut_py<F, R>(self, f: F) -> R where
    Self: IntoPyPointer,
    F: FnOnce(Python, PyRefMut<T>) -> R, 

Loading content...

Implementors

impl AsPyRef<PyAny> for PyObject[src]

impl<T> AsPyRef<T> for Py<T> where
    T: PyTypeInfo
[src]

Loading content...