1- use pyo3:: class:: { methods :: PyMethods , proto_methods :: PyProtoMethods } ;
2- use pyo3:: pyclass:: { PyClass , PyClassAlloc , PyClassSend , ThreadCheckerStub } ;
1+ use pyo3:: class:: impl_ :: { PyClassImpl , ThreadCheckerStub } ;
2+ use pyo3:: pyclass:: PyClass ;
33use pyo3:: pyclass_slots:: PyClassDummySlot ;
4- use pyo3:: { ffi, type_object, types:: PyAny , PyCell , PyClassInitializer } ;
4+ use pyo3:: { ffi, type_object, types:: PyAny , PyCell } ;
55
66pub ( crate ) struct SliceBox < T > {
77 pub ( crate ) data : * mut [ T ] ,
@@ -21,25 +21,24 @@ impl<T> Drop for SliceBox<T> {
2121 }
2222}
2323
24- impl < T > PyClassAlloc for SliceBox < T > { }
25-
2624impl < T > PyClass for SliceBox < T > {
2725 type Dict = PyClassDummySlot ;
2826 type WeakRef = PyClassDummySlot ;
2927 type BaseNativeType = PyAny ;
3028}
3129
32- unsafe impl < T > type_object:: PyTypeInfo for SliceBox < T > {
33- type Type = ( ) ;
30+ impl < T > PyClassImpl for SliceBox < T > {
31+ const DOC : & ' static str = "Memory store for PyArray using rust's Box<[T]> \0 " ;
32+
3433 type BaseType = PyAny ;
35- type BaseLayout = pyo3:: pycell:: PyCellBase < PyAny > ;
3634 type Layout = PyCell < Self > ;
37- type Initializer = PyClassInitializer < Self > ;
35+ type ThreadChecker = ThreadCheckerStub < Self > ;
36+ }
37+
38+ unsafe impl < T > type_object:: PyTypeInfo for SliceBox < T > {
3839 type AsRefTarget = PyCell < Self > ;
3940 const NAME : & ' static str = "SliceBox" ;
4041 const MODULE : Option < & ' static str > = Some ( "_rust_numpy" ) ;
41- const DESCRIPTION : & ' static str = "Memory store for PyArray using rust's Box<[T]> \0 " ;
42- const FLAGS : usize = 0 ;
4342
4443 #[ inline]
4544 fn type_object_raw ( py : pyo3:: Python ) -> * mut ffi:: PyTypeObject {
@@ -49,10 +48,4 @@ unsafe impl<T> type_object::PyTypeInfo for SliceBox<T> {
4948 }
5049}
5150
52- // Some stubs to use PyClass
53- impl < T > PyMethods for SliceBox < T > { }
54- impl < T > PyProtoMethods for SliceBox < T > { }
5551unsafe impl < T > Send for SliceBox < T > { }
56- impl < T > PyClassSend for SliceBox < T > {
57- type ThreadChecker = ThreadCheckerStub < Self > ;
58- }
0 commit comments