Skip to content

Commit b5af0ed

Browse files
committed
Add missing zero-dimensional type aliases for array borrows.
1 parent 06a93f1 commit b5af0ed

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/borrow/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ use std::fmt;
167167
use std::ops::Deref;
168168

169169
use ndarray::{
170-
ArrayView, ArrayViewMut, Dimension, IntoDimension, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, IxDyn,
170+
ArrayView, ArrayViewMut, Dimension, IntoDimension, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, IxDyn,
171171
};
172172
use pyo3::{FromPyObject, PyAny, PyResult};
173173

@@ -193,6 +193,9 @@ where
193193
array: &'py PyArray<T, D>,
194194
}
195195

196+
/// Read-only borrow of a zero-dimensional array.
197+
pub type PyReadonlyArray0<'py, T> = PyReadonlyArray<'py, T, Ix0>;
198+
196199
/// Read-only borrow of a one-dimensional array.
197200
pub type PyReadonlyArray1<'py, T> = PyReadonlyArray<'py, T, Ix1>;
198201

@@ -374,6 +377,9 @@ where
374377
array: &'py PyArray<T, D>,
375378
}
376379

380+
/// Read-write borrow of a zero-dimensional array.
381+
pub type PyReadwriteArray0<'py, T> = PyReadwriteArray<'py, T, Ix0>;
382+
377383
/// Read-write borrow of a one-dimensional array.
378384
pub type PyReadwriteArray1<'py, T> = PyReadwriteArray<'py, T, Ix1>;
379385

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ pub use crate::array::{
9595
PyArray6, PyArrayDyn,
9696
};
9797
pub use crate::borrow::{
98-
PyReadonlyArray, PyReadonlyArray1, PyReadonlyArray2, PyReadonlyArray3, PyReadonlyArray4,
99-
PyReadonlyArray5, PyReadonlyArray6, PyReadonlyArrayDyn, PyReadwriteArray, PyReadwriteArray1,
100-
PyReadwriteArray2, PyReadwriteArray3, PyReadwriteArray4, PyReadwriteArray5, PyReadwriteArray6,
101-
PyReadwriteArrayDyn,
98+
PyReadonlyArray, PyReadonlyArray0, PyReadonlyArray1, PyReadonlyArray2, PyReadonlyArray3,
99+
PyReadonlyArray4, PyReadonlyArray5, PyReadonlyArray6, PyReadonlyArrayDyn, PyReadwriteArray,
100+
PyReadwriteArray0, PyReadwriteArray1, PyReadwriteArray2, PyReadwriteArray3, PyReadwriteArray4,
101+
PyReadwriteArray5, PyReadwriteArray6, PyReadwriteArrayDyn,
102102
};
103103
pub use crate::convert::{IntoPyArray, NpyIndex, ToNpyDims, ToPyArray};
104104
pub use crate::dtype::{dtype, Complex32, Complex64, Element, PyArrayDescr};

0 commit comments

Comments
 (0)