@@ -333,7 +333,21 @@ where Slice: AsRef<[A]>
333333 }
334334}
335335
336- /// Implementation of ArrayView2::from(&S) where S is a slice to a 2D array
336+ /// Implementation of ArrayView2::from(&[[A; N]; M])
337+ ///
338+ /// **Panics** if the product of non-zero axis lengths overflows `isize` (This can only occur if A
339+ /// is zero-sized because slices cannot contain more than `isize::MAX` number of bytes).
340+ /// **Panics** if N == 0 and the number of rows is greater than isize::MAX.
341+ impl < ' a , A , const M : usize , const N : usize > From < & ' a [ [ A ; N ] ; M ] > for ArrayView < ' a , A , Ix2 >
342+ {
343+ /// Create a two-dimensional read-only array view of the data in `slice`
344+ fn from ( xs : & ' a [ [ A ; N ] ; M ] ) -> Self
345+ {
346+ Self :: from ( & xs[ ..] )
347+ }
348+ }
349+
350+ /// Implementation of ArrayView2::from(&[[A; N]])
337351///
338352/// **Panics** if the product of non-zero axis lengths overflows `isize`. (This
339353/// can only occur if A is zero-sized or if `N` is zero, because slices cannot
@@ -380,7 +394,21 @@ where Slice: AsMut<[A]>
380394 }
381395}
382396
383- /// Implementation of ArrayViewMut2::from(&S) where S is a slice to a 2D array
397+ /// Implementation of ArrayViewMut2::from(&mut [[A; N]; M])
398+ ///
399+ /// **Panics** if the product of non-zero axis lengths overflows `isize` (This can only occur if A
400+ /// is zero-sized because slices cannot contain more than `isize::MAX` number of bytes).
401+ /// **Panics** if N == 0 and the number of rows is greater than isize::MAX.
402+ impl < ' a , A , const M : usize , const N : usize > From < & ' a mut [ [ A ; N ] ; M ] > for ArrayViewMut < ' a , A , Ix2 >
403+ {
404+ /// Create a two-dimensional read-write array view of the data in `slice`
405+ fn from ( xs : & ' a mut [ [ A ; N ] ; M ] ) -> Self
406+ {
407+ Self :: from ( & mut xs[ ..] )
408+ }
409+ }
410+
411+ /// Implementation of ArrayViewMut2::from(&mut [[A; N]])
384412///
385413/// **Panics** if the product of non-zero axis lengths overflows `isize`. (This
386414/// can only occur if `A` is zero-sized or if `N` is zero, because slices
0 commit comments