|
1 | 1 | use std::{mem, slice}; |
2 | 2 |
|
3 | 3 | use ndarray::{ArrayBase, Dimension, OwnedRepr}; |
4 | | -use pyo3::{ |
5 | | - ffi, |
6 | | - impl_::pyclass::{PyClassDummySlot, PyClassImpl, PyClassItems, ThreadCheckerStub}, |
7 | | - pyclass::PyClass, |
8 | | - type_object::{LazyStaticType, PyTypeInfo}, |
9 | | - PyAny, PyCell, Python, |
10 | | -}; |
| 4 | +use pyo3::pyclass; |
11 | 5 |
|
12 | 6 | /// Utility type to safely store `Box<[_]>` or `Vec<_>` on the Python heap |
| 7 | +#[pyclass] |
13 | 8 | pub(crate) struct PySliceContainer { |
14 | 9 | ptr: *mut u8, |
15 | 10 | len: usize, |
@@ -84,32 +79,3 @@ impl Drop for PySliceContainer { |
84 | 79 | } |
85 | 80 | } |
86 | 81 | } |
87 | | - |
88 | | -impl PyClass for PySliceContainer { |
89 | | - type Dict = PyClassDummySlot; |
90 | | - type WeakRef = PyClassDummySlot; |
91 | | - type BaseNativeType = PyAny; |
92 | | -} |
93 | | - |
94 | | -impl PyClassImpl for PySliceContainer { |
95 | | - const DOC: &'static str = "Memory store for a PyArray backed by a Box<[_]> or a Vec<_> \0"; |
96 | | - |
97 | | - type BaseType = PyAny; |
98 | | - type Layout = PyCell<Self>; |
99 | | - type ThreadChecker = ThreadCheckerStub<Self>; |
100 | | - |
101 | | - fn for_all_items(_visitor: &mut dyn FnMut(&PyClassItems)) {} |
102 | | -} |
103 | | - |
104 | | -unsafe impl PyTypeInfo for PySliceContainer { |
105 | | - type AsRefTarget = PyCell<Self>; |
106 | | - |
107 | | - const NAME: &'static str = "PySliceContainer"; |
108 | | - const MODULE: Option<&'static str> = Some("_rust_numpy"); |
109 | | - |
110 | | - #[inline] |
111 | | - fn type_object_raw(py: Python) -> *mut ffi::PyTypeObject { |
112 | | - static TYPE_OBJECT: LazyStaticType = LazyStaticType::new(); |
113 | | - TYPE_OBJECT.get_or_init::<Self>(py) |
114 | | - } |
115 | | -} |
0 commit comments