MCPcopy Create free account
hub / github.com/PyO3/rust-numpy / ndim

Method ndim

src/dtype.rs:349–355  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

347 }
348
349 fn ndim(&self) -> usize {
350 let subarray = unsafe { PyDataType_SUBARRAY(self.py(), self.as_dtype_ptr()).as_ref() };
351 match subarray {
352 None => 0,
353 Some(subarray) => unsafe { PyTuple_Size(subarray.shape) }.max(0) as _,
354 }
355 }
356
357 fn base(&self) -> Bound<'py, PyArrayDescr> {
358 let subarray = unsafe { PyDataType_SUBARRAY(self.py(), self.as_dtype_ptr()).as_ref() };

Callers 4

extractMethod · 0.45
orderMethod · 0.45
ndim_cintMethod · 0.45

Calls 1

as_dtype_ptrMethod · 0.80

Tested by

no test coverage detected