[][src]Trait pyo3::typeob::PyObjectAlloc

pub trait PyObjectAlloc<T> {
    unsafe fn alloc(py: Python) -> PyResult<*mut PyObject>;
unsafe fn dealloc(py: Python, obj: *mut PyObject); unsafe fn drop(_py: Python, _obj: *mut PyObject) { ... } }

A Python object allocator that is usable as a base type for #[pyclass]

Required methods

unsafe fn alloc(py: Python) -> PyResult<*mut PyObject>

Allocates a new object (usually by calling ty->tp_alloc),

unsafe fn dealloc(py: Python, obj: *mut PyObject)

Calls the rust destructor for the object and frees the memory (usually by calling ptr->ob_type->tp_free). This function is used as tp_dealloc implementation.

Loading content...

Provided methods

unsafe fn drop(_py: Python, _obj: *mut PyObject)

Calls the rust destructor for the object.

Loading content...

Implementors

impl<T> PyObjectAlloc<T> for T where
    T: PyObjectWithFreeList
[src]

unsafe fn drop(_py: Python, _obj: *mut PyObject)[src]

impl<T> PyObjectAlloc<T> for T where
    T: PyTypeInfo
[src]

unsafe fn drop(py: Python, obj: *mut PyObject)[src]

Calls the rust destructor for the object.

Loading content...