[][src]Trait pyo3::pyclass::PyClassAlloc

pub trait PyClassAlloc: PyTypeInfo + Sized {
    unsafe fn alloc(_py: Python) -> *mut Self::Layout { ... }
unsafe fn dealloc(py: Python, self_: *mut Self::Layout) { ... } }

This trait enables custom alloc/dealloc implementations for T: PyClass.

Provided methods

unsafe fn alloc(_py: Python) -> *mut Self::Layout

Allocate the actual field for #[pyclass].

Safety

This function must return a valid pointer to the Python heap.

unsafe fn dealloc(py: Python, self_: *mut Self::Layout)

Deallocate #[pyclass] on the Python heap.

Safety

self_ must be a valid pointer to the Python heap.

Loading content...

Implementors

impl<T> PyClassAlloc for T where
    T: PyTypeInfo + PyClassWithFreeList
[src]

Loading content...