Trait pyo3::typeob::PyObjectAlloc
[−]
[src]
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 #class
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.
Provided Methods
Implementors
impl<T> PyObjectAlloc<T> for T where
T: PyTypeInfo,impl<T> PyObjectAlloc<T> for T where
T: PyObjectWithFreeList,