Struct pyo3::Py [] [src]

pub struct Py<T>(pub *mut PyObject, _);

Safe wrapper around unsafe *mut ffi::PyObject pointer with specified type information.

Methods

impl<T> Py<T>
[src]

[src]

Creates a Py<T> instance for the given FFI pointer. This moves ownership over the pointer into the Py<T>. Undefined behavior if the pointer is NULL or invalid.

[src]

Creates a Py<T> instance for the given FFI pointer. Panics if the pointer is null. Undefined behavior if the pointer is invalid.

[src]

Construct Py<T> from the result of a Python FFI call that returns a new reference (owned pointer). Returns Err(PyErr) if the pointer is null. Unsafe because the pointer might be invalid.

[src]

Creates a Py<T> instance for the given Python FFI pointer. Calls Py_INCREF() on the ptr. Undefined behavior if the pointer is NULL or invalid.

[src]

Gets the reference count of the ffi::PyObject pointer.

[src]

Clone self, Calls Py_INCREF() on the ptr.

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

[src]

Create new instance of T and move it under python management Returns Py<T>.

[src]

Create new instance of T and move it under python management. Returns references to T

[src]

Create new instance of T and move it under python management. Returns mutable references to T

Trait Implementations

impl<T: Debug> Debug for Py<T>
[src]

[src]

Formats the value using the given formatter. Read more

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

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

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

[src]

Return reference to object.

[src]

Return mutable reference to object.

[src]

Acquire python gil and call closure with object reference.

[src]

Acquire python gil and call closure with mutable object reference.

[src]

[src]

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

[src]

Return reference to object.

[src]

Return mutable reference to object.

[src]

Acquire python gil and call closure with object reference.

[src]

Acquire python gil and call closure with mutable object reference.

[src]

[src]

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

[src]

Converts Py instance -> PyObject.

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

[src]

Converts Py instance -> PyObject. Consumes self without calling Py_DECREF()

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

[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

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

[src]

Gets the underlying FFI pointer, returns a owned pointer.

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

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

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

Dropping a Py instance decrements the reference count on the object by 1.

[src]

Executes the destructor for this type. Read more

impl<T> From<Py<T>> for PyObject
[src]

[src]

Performs the conversion.

impl<'a, T> From<&'a T> for Py<T> where
    T: ToPyPointer
[src]

[src]

Performs the conversion.

impl<'a, T> From<&'a mut T> for Py<T> where
    T: ToPyPointer
[src]

[src]

Performs the conversion.

impl<'a, T> FromPyObject<'a> for Py<T> where
    T: ToPyPointer,
    &'a T: 'a + FromPyObject<'a>, 
[src]

[src]

Extracts Self from the source PyObject.

impl IntoPyDictPointer for Py<PyDict>
[src]

[src]

Converts self into a PyDict object pointer. Whether pointer owned or borrowed depends on implementation. Read more

impl IntoPyTuple for Py<PyTuple>
[src]

[src]

Converts self into a PyTuple object.