logo
pub fn aview_mut1<A>(
    xs: &mut [A]
) -> ArrayBase<ViewRepr<&mut A>, Dim<[usize; 1]>>
Expand description

Create a one-dimensional read-write array view with elements borrowing xs.

use ndarray::{aview_mut1, s};
// Create an array view over some data, then slice it and modify it.
let mut data = [0; 1024];
{
    let mut a = aview_mut1(&mut data).into_shape((32, 32)).unwrap();
    a.slice_mut(s![.., ..;3]).fill(5);
}
assert_eq!(&data[..10], [5, 0, 0, 5, 0, 0, 5, 0, 0, 5]);