ref-mut-n

Crates.ioref-mut-n
lib.rsref-mut-n
version1.0.1
sourcesrc
created_at2022-03-19 05:53:55.596066
updated_at2022-03-21 21:12:27.087053
descriptionDefines a nested mutable reference.
homepage
repository
max_upload_size
id553041
size4,451
mmmpa (mmmpa)

documentation

README

ref_mut_n

This defines a nested mutable reference.

[dependencies]
ref-mut-n = "1"
use ref_mut_n::ref_mut_n;

fn main() {
    let mut data = [[0u8; 3]; 4];
    let _ref_data: &mut [&mut [u8]] = ref_mut_n!(data, 4);
}

work as

let _ref_data: &mut [&mut [u8]] = {
    let [ref mut a0, ref mut a1, ref mut a2, ref mut a3] = data;
    &mut[a0, a1, a2, a3]
}
Commit count: 0

cargo fmt