@@ -530,7 +530,7 @@ where
530
530
/// ### Safety
531
531
///
532
532
/// The whole of the array must be initialized before it is converted
533
- /// using [`.assume_init()`] or otherwise traversed.
533
+ /// using [`.assume_init()`] or otherwise traversed/read with the element type `A` .
534
534
///
535
535
/// ### Examples
536
536
///
@@ -580,10 +580,10 @@ where
580
580
/// The uninitialized elements of type `A` are represented by the type `MaybeUninit<A>`,
581
581
/// an easier way to handle uninit values correctly.
582
582
///
583
- /// The `builder` closure gets unshared access to the array through a raw view
584
- /// and can use it to modify the array before it is returned. This allows initializing
585
- /// the array for any owned array type (avoiding clone requirements for copy-on-write,
586
- /// because the array is unshared when initially created).
583
+ /// The `builder` closure gets unshared access to the array through a view and can use it to
584
+ /// modify the array before it is returned. This allows initializing the array for any owned
585
+ /// array type (avoiding clone requirements for copy-on-write, because the array is unshared
586
+ /// when initially created).
587
587
///
588
588
/// Only *when* the array is completely initialized with valid elements, can it be
589
589
/// converted to an array of `A` elements using [`.assume_init()`].
@@ -593,17 +593,18 @@ where
593
593
/// ### Safety
594
594
///
595
595
/// The whole of the array must be initialized before it is converted
596
- /// using [`.assume_init()`] or otherwise traversed.
596
+ /// using [`.assume_init()`] or otherwise traversed/read with the element type `A` .
597
597
///
598
- pub ( crate ) fn build_uninit < Sh , F > ( shape : Sh , builder : F ) -> ArrayBase < S :: MaybeUninit , D >
598
+ /// [`.assume_init()`]: ArrayBase::assume_init
599
+ pub fn build_uninit < Sh , F > ( shape : Sh , builder : F ) -> ArrayBase < S :: MaybeUninit , D >
599
600
where
600
601
Sh : ShapeBuilder < Dim = D > ,
601
- F : FnOnce ( RawArrayViewMut < MaybeUninit < A > , D > ) ,
602
+ F : FnOnce ( ArrayViewMut < MaybeUninit < A > , D > ) ,
602
603
{
603
604
let mut array = Self :: uninit ( shape) ;
604
605
// Safe because: the array is unshared here
605
606
unsafe {
606
- builder ( array. raw_view_mut_unchecked ( ) ) ;
607
+ builder ( array. raw_view_mut_unchecked ( ) . deref_into_view_mut ( ) ) ;
607
608
}
608
609
array
609
610
}
0 commit comments