File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ where
115
115
/// Note that while this is similar to [`ArrayBase::as_slice_mut()`], this method tranfers the
116
116
/// view's lifetime to the slice.
117
117
pub fn into_slice ( self ) -> Option < & ' a mut [ A ] > {
118
- self . into_slice_ ( ) . ok ( )
118
+ self . try_into_slice ( ) . ok ( )
119
119
}
120
120
}
121
121
@@ -173,7 +173,9 @@ where
173
173
ElementsBaseMut :: new ( self )
174
174
}
175
175
176
- pub ( crate ) fn into_slice_ ( self ) -> Result < & ' a mut [ A ] , Self > {
176
+ /// Return the array’s data as a slice, if it is contiguous and in standard order.
177
+ /// Otherwise return self in the Err branch of the result.
178
+ pub ( crate ) fn try_into_slice ( self ) -> Result < & ' a mut [ A ] , Self > {
177
179
if self . is_standard_layout ( ) {
178
180
unsafe { Ok ( slice:: from_raw_parts_mut ( self . ptr . as_ptr ( ) , self . len ( ) ) ) }
179
181
} else {
Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ where
294
294
{
295
295
pub ( crate ) fn new ( self_ : ArrayViewMut < ' a , A , D > ) -> Self {
296
296
IterMut {
297
- inner : match self_. into_slice_ ( ) {
297
+ inner : match self_. try_into_slice ( ) {
298
298
Ok ( x) => ElementsRepr :: Slice ( x. iter_mut ( ) ) ,
299
299
Err ( self_) => ElementsRepr :: Counted ( self_. into_elements_base ( ) ) ,
300
300
} ,
You can’t perform that action at this time.
0 commit comments