@@ -549,15 +549,19 @@ where
549
549
550
550
/// Converts slice to a generic array reference with inferred length;
551
551
///
552
- /// Length of the slice must be equal to the length of the array.
552
+ /// # Panics
553
+ ///
554
+ /// Panics if the slice is not equal to the length of the array.
553
555
#[ inline]
554
556
pub fn from_slice ( slice : & [ T ] ) -> & GenericArray < T , N > {
555
557
slice. into ( )
556
558
}
557
559
558
560
/// Converts mutable slice to a mutable generic array reference
559
561
///
560
- /// Length of the slice must be equal to the length of the array.
562
+ /// # Panics
563
+ ///
564
+ /// Panics if the slice is not equal to the length of the array.
561
565
#[ inline]
562
566
pub fn from_mut_slice ( slice : & mut [ T ] ) -> & mut GenericArray < T , N > {
563
567
slice. into ( )
@@ -567,7 +571,9 @@ where
567
571
impl < ' a , T , N : ArrayLength < T > > From < & ' a [ T ] > for & ' a GenericArray < T , N > {
568
572
/// Converts slice to a generic array reference with inferred length;
569
573
///
570
- /// Length of the slice must be equal to the length of the array.
574
+ /// # Panics
575
+ ///
576
+ /// Panics if the slice is not equal to the length of the array.
571
577
#[ inline]
572
578
fn from ( slice : & [ T ] ) -> & GenericArray < T , N > {
573
579
assert_eq ! ( slice. len( ) , N :: USIZE ) ;
@@ -579,7 +585,9 @@ impl<'a, T, N: ArrayLength<T>> From<&'a [T]> for &'a GenericArray<T, N> {
579
585
impl < ' a , T , N : ArrayLength < T > > From < & ' a mut [ T ] > for & ' a mut GenericArray < T , N > {
580
586
/// Converts mutable slice to a mutable generic array reference
581
587
///
582
- /// Length of the slice must be equal to the length of the array.
588
+ /// # Panics
589
+ ///
590
+ /// Panics if the slice is not equal to the length of the array.
583
591
#[ inline]
584
592
fn from ( slice : & mut [ T ] ) -> & mut GenericArray < T , N > {
585
593
assert_eq ! ( slice. len( ) , N :: USIZE ) ;
@@ -594,7 +602,9 @@ where
594
602
{
595
603
/// Construct a `GenericArray` from a slice by cloning its content
596
604
///
597
- /// Length of the slice must be equal to the length of the array
605
+ /// # Panics
606
+ ///
607
+ /// Panics if the slice is not equal to the length of the array.
598
608
#[ inline]
599
609
pub fn clone_from_slice ( list : & [ T ] ) -> GenericArray < T , N > {
600
610
Self :: from_exact_iter ( list. iter ( ) . cloned ( ) )
0 commit comments