Skip to content

Commit 612e867

Browse files
committed
Add PyArrayDescr::is_equiv_to()
1 parent 5f1b3b6 commit 612e867

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/dtype.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ impl PyArrayDescr {
8484
T::get_dtype(py)
8585
}
8686

87+
/// Returns true if two type descriptors are equivalent.
88+
pub fn is_equiv_to(&self, other: &Self) -> bool {
89+
unsafe { PY_ARRAY_API.PyArray_EquivTypes(self.as_dtype_ptr(), other.as_dtype_ptr()) != 0 }
90+
}
91+
8792
fn from_npy_type(py: Python, npy_type: NPY_TYPES) -> &Self {
8893
unsafe {
8994
let descr = PY_ARRAY_API.PyArray_DescrFromType(npy_type as _);

0 commit comments

Comments
 (0)