Crates.io | ref-mut-n |
lib.rs | ref-mut-n |
version | 1.0.1 |
source | src |
created_at | 2022-03-19 05:53:55.596066 |
updated_at | 2022-03-21 21:12:27.087053 |
description | Defines a nested mutable reference. |
homepage | |
repository | |
max_upload_size | |
id | 553041 |
size | 4,451 |
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]
}