[][src]Trait pyo3::conversion::AsPyPointer

pub trait AsPyPointer {
    fn as_ptr(&self) -> *mut PyObject;
}

This trait represents that we can do zero-cost conversion from the object to a FFI pointer.

This trait is implemented for types that internally wrap a pointer to a Python object.

Example

use pyo3::{AsPyPointer, prelude::*};
let gil = Python::acquire_gil();
let dict = pyo3::types::PyDict::new(gil.python());
// All native object wrappers implement AsPyPointer!!!
assert_ne!(dict.as_ptr(), std::ptr::null_mut());

Required methods

fn as_ptr(&self) -> *mut PyObject

Retrieves the underlying FFI pointer (as a borrowed pointer).

Loading content...

Implementations on Foreign Types

impl<T> AsPyPointer for Option<T> where
    T: AsPyPointer
[src]

Convert None into a null pointer.

Loading content...

Implementors

impl AsPyPointer for PyModule[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyAny[src]

impl AsPyPointer for PyObject[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyBool[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyByteArray[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyBytes[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyComplex[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyDate[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyDateTime[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyDelta[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyDict[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyFloat[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyFrozenSet[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyList[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyLong[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PySequence[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PySet[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PySlice[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyString[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyTime[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyTuple[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyType[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl AsPyPointer for PyTzInfo[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl<'a, T: PyClass> AsPyPointer for PyRef<'a, T>[src]

impl<'a, T: PyClass> AsPyPointer for PyRefMut<'a, T>[src]

impl<T> AsPyPointer for Py<T>[src]

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

impl<T: PyClass> AsPyPointer for PyCell<T>[src]

Loading content...