Skip to content

Commit 8baa60c

Browse files
committed
Simplify impl PyTypeInfo for SliceBox
1 parent a5d7f75 commit 8baa60c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/slice_box.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use crate::types::TypeNum;
22
use pyo3::{ffi, typeob, types::PyObjectRef, PyObjectAlloc, Python, ToPyPointer};
33
use std::os::raw::c_void;
44

5+
/// It's a memory store for IntoPyArray.
6+
/// See IntoPyArray's doc for what concretely this type is for.
57
#[repr(C)]
68
pub(crate) struct SliceBox<T> {
79
ob_base: ffi::PyObject,
@@ -28,9 +30,9 @@ impl<T> typeob::PyTypeInfo for SliceBox<T> {
2830
type Type = ();
2931
type BaseType = PyObjectRef;
3032
const NAME: &'static str = "SliceBox";
31-
const DESCRIPTION: &'static str = "Memory store for PyArray made by IntoPyArray.";
33+
const DESCRIPTION: &'static str = "Memory store for PyArray using rust's Box<[T]>.";
3234
const FLAGS: usize = 0;
33-
const SIZE: usize = { Self::OFFSET as usize + std::mem::size_of::<Self>() + 0 + 0 };
35+
const SIZE: usize = std::mem::size_of::<Self>();
3436
const OFFSET: isize = 0;
3537
#[inline]
3638
unsafe fn type_object() -> &'static mut ffi::PyTypeObject {

0 commit comments

Comments
 (0)