Skip to content

Commit 1fdc903

Browse files
committed
Improve multislice documentation
1 parent bae6ffc commit 1fdc903

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/slice.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,8 @@ pub unsafe fn deref_raw_view_mut_into_view_mut_with_life<'a, A, D: Dimension>(
675675
/// don't need `multislice!()`; just call
676676
/// [`.slice()`](struct.ArrayBase.html#method.slice) multiple times instead.
677677
///
678-
/// `multislice!()` follows Rust's aliasing rules:
678+
/// `multislice!()` evaluates to a tuple of `ArrayView` and/or `ArrayViewMut`
679+
/// instances. It checks Rust's aliasing rules:
679680
///
680681
/// * An `ArrayViewMut` and `ArrayView` cannot reference the same element.
681682
/// * Two `ArrayViewMut` cannot reference the same element.
@@ -692,9 +693,9 @@ pub unsafe fn deref_raw_view_mut_into_view_mut_with_life<'a, A, D: Dimension>(
692693
/// the other slices.
693694
///
694695
/// ```
695-
/// #[macro_use]
696696
/// extern crate ndarray;
697697
///
698+
/// use ndarray::multislice;
698699
/// use ndarray::prelude::*;
699700
///
700701
/// # fn main() {
@@ -712,7 +713,8 @@ pub unsafe fn deref_raw_view_mut_into_view_mut_with_life<'a, A, D: Dimension>(
712713
/// * `ArrayViewMut` and `ArrayView` cannot reference the same element.
713714
///
714715
/// ```should_panic
715-
/// # #[macro_use] extern crate ndarray;
716+
/// # extern crate ndarray;
717+
/// # use ndarray::multislice;
716718
/// # use ndarray::prelude::*;
717719
/// # fn main() {
718720
/// let mut arr = Array1::from_iter(0..12);
@@ -723,7 +725,8 @@ pub unsafe fn deref_raw_view_mut_into_view_mut_with_life<'a, A, D: Dimension>(
723725
/// * Two `ArrayViewMut` cannot reference the same element.
724726
///
725727
/// ```should_panic
726-
/// # #[macro_use] extern crate ndarray;
728+
/// # extern crate ndarray;
729+
/// # use ndarray::multislice;
727730
/// # use ndarray::prelude::*;
728731
/// # fn main() {
729732
/// let mut arr = Array1::from_iter(0..12);

0 commit comments

Comments
 (0)