@@ -118,7 +118,7 @@ impl PyArrayDescr {
118
118
unsafe { * self . as_dtype_ptr ( ) } . elsize . max ( 0 ) as _
119
119
}
120
120
121
- /// Returns the required alignment (bytes) of this data-type according to the compiler
121
+ /// Returns the required alignment (bytes) of this data-type according to the compiler.
122
122
///
123
123
/// Equivalent to [`np.dtype.alignment`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.alignment.html).
124
124
pub fn alignment ( & self ) -> usize {
@@ -138,7 +138,7 @@ impl PyArrayDescr {
138
138
///
139
139
/// Note: structured data types are categorized as `V` (void).
140
140
///
141
- /// Equivalent to [`np.dtype.char`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.char.html)
141
+ /// Equivalent to [`np.dtype.char`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.char.html).
142
142
pub fn char ( & self ) -> u8 {
143
143
unsafe { * self . as_dtype_ptr ( ) } . type_ . max ( 0 ) as _
144
144
}
@@ -147,21 +147,21 @@ impl PyArrayDescr {
147
147
///
148
148
/// Note: structured data types are categorized as `V` (void).
149
149
///
150
- /// Equivalent to [`np.dtype.kind`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.kind.html)
150
+ /// Equivalent to [`np.dtype.kind`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.kind.html).
151
151
pub fn kind ( & self ) -> u8 {
152
152
unsafe { * self . as_dtype_ptr ( ) } . kind . max ( 0 ) as _
153
153
}
154
154
155
155
/// Returns bit-flags describing how this data type is to be interpreted.
156
156
///
157
- /// Equivalent to [`np.dtype.flags`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.flags.html)
157
+ /// Equivalent to [`np.dtype.flags`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.flags.html).
158
158
pub fn flags ( & self ) -> c_char {
159
159
unsafe { * self . as_dtype_ptr ( ) } . flags
160
160
}
161
161
162
162
/// Returns the number of dimensions if this data type describes a sub-array, and `0` otherwise.
163
163
///
164
- /// Equivalent to [`np.dtype.ndim`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.ndim.html)
164
+ /// Equivalent to [`np.dtype.ndim`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.ndim.html).
165
165
pub fn ndim ( & self ) -> usize {
166
166
if !self . has_subarray ( ) {
167
167
return 0 ;
@@ -181,7 +181,7 @@ impl PyArrayDescr {
181
181
182
182
/// Returns shape tuple of the sub-array if this dtype is a sub-array, and `None` otherwise.
183
183
///
184
- /// Equivalent to [`np.dtype.shape`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.shape.html)
184
+ /// Equivalent to [`np.dtype.shape`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.shape.html).
185
185
pub fn shape ( & self ) -> Option < Vec < usize > > {
186
186
if !self . has_subarray ( ) {
187
187
return None ;
@@ -204,15 +204,15 @@ impl PyArrayDescr {
204
204
/// If a field whose dtype object has this attribute is retrieved, then the extra dimensions
205
205
/// implied by shape are tacked on to the end of the retrieved array.
206
206
///
207
- /// Equivalent to [`np.dtype.subdtype`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.subdtype.html)
207
+ /// Equivalent to [`np.dtype.subdtype`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.subdtype.html).
208
208
pub fn subdtype ( & self ) -> Option < ( & PyArrayDescr , Vec < usize > ) > {
209
209
self . shape ( )
210
210
. and_then ( |shape| self . base ( ) . map ( |base| ( base, shape) ) )
211
211
}
212
212
213
213
/// Returns true if the dtype is a sub-array at the top level.
214
214
///
215
- /// Equivalent to [`np.dtype.hasobject`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.hasobject.html)
215
+ /// Equivalent to [`np.dtype.hasobject`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.hasobject.html).
216
216
pub fn has_object ( & self ) -> bool {
217
217
self . flags ( ) & NPY_ITEM_HASOBJECT != 0
218
218
}
@@ -222,7 +222,7 @@ impl PyArrayDescr {
222
222
/// This flag is sticky, so when combining multiple structs together, it is preserved
223
223
/// and produces new dtypes which are also aligned.
224
224
///
225
- /// Equivalent to [`np.dtype.isalignedstruct`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.isalignedstruct.html)
225
+ /// Equivalent to [`np.dtype.isalignedstruct`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.isalignedstruct.html).
226
226
pub fn is_aligned_struct ( & self ) -> bool {
227
227
self . flags ( ) & NPY_ALIGNED_STRUCT != 0
228
228
}
@@ -239,7 +239,7 @@ impl PyArrayDescr {
239
239
unsafe { !( * self . as_dtype_ptr ( ) ) . names . is_null ( ) }
240
240
}
241
241
242
- /// Returns true if the data type is unsized
242
+ /// Returns true if the data type is unsized.
243
243
pub fn is_unsized ( & self ) -> bool {
244
244
// equivalent to PyDataType_ISUNSIZED(self)
245
245
self . itemsize ( ) == 0 && !self . has_fields ( )
0 commit comments