A PythonObject that is usable as a base type with the `py_class!()` macro.
| 112 | |
| 113 | /// A PythonObject that is usable as a base type with the `py_class!()` macro. |
| 114 | pub trait BaseObject: PythonObject { |
| 115 | /// Gets the size of the object, in bytes. |
| 116 | fn size() -> usize; |
| 117 | |
| 118 | type InitType; |
| 119 | |
| 120 | /// Allocates a new object (usually by calling ty->tp_alloc), |
| 121 | /// and initializes it using init_val. |
| 122 | /// `ty` must be derived from the Self type, and the resulting object |
| 123 | /// must be of type `ty`. |
| 124 | unsafe fn alloc(py: Python, ty: &PyType, init_val: Self::InitType) -> PyResult<PyObject>; |
| 125 | |
| 126 | /// Calls the rust destructor for the object and frees the memory |
| 127 | /// (usually by calling ptr->ob_type->tp_free). |
| 128 | /// This function is used as tp_dealloc implementation. |
| 129 | unsafe fn dealloc(py: Python, obj: *mut ffi::PyObject); |
| 130 | } |
| 131 | |
| 132 | impl BaseObject for PyObject { |
| 133 | #[inline] |
nothing calls this directly
no outgoing calls
no test coverage detected