[−][src]Macro reed_solomon_erasure::convert_2D_slices
Makes it easier to work with 2D slices, arrays, etc.
Examples
Byte arrays on stack to Vec<&[u8]>
let array: [[u8; 3]; 2] = [[1, 2, 3], [4, 5, 6]]; let refs: Vec<&[u8]> = convert_2D_slices!(array =>to_vec &[u8]);
Byte arrays on stack to Vec<&mut [u8]>
(borrow mutably)
let mut array: [[u8; 3]; 2] = [[1, 2, 3], [4, 5, 6]]; let refs: Vec<&mut [u8]> = convert_2D_slices!(array =>to_mut_vec &mut [u8]);
Byte arrays on stack to SmallVec<[&mut [u8]; 32]>
(borrow mutably)
let mut array: [[u8; 3]; 2] = [[1, 2, 3], [4, 5, 6]]; let refs: SmallVec<[&mut [u8]; 32]> = convert_2D_slices!(array =>to_mut SmallVec<[&mut [u8]; 32]>, SmallVec::with_capacity);
Shard array to SmallVec<[&mut [u8]; 32]>
(borrow mutably)
let mut shards = shards!([1, 2, 3], [4, 5, 6]); let refs: SmallVec<[&mut [u8]; 32]> = convert_2D_slices!(shards =>to_mut SmallVec<[&mut [u8]; 32]>, SmallVec::with_capacity);
Shard array to Vec<&mut [u8]>
(borrow mutably) into SmallVec<[&mut [u8]; 32]>
(move)
let mut shards = shards!([1, 2, 3], [4, 5, 6]); let refs1 = convert_2D_slices!(shards =>to_mut_vec &mut [u8]); let refs2: SmallVec<[&mut [u8]; 32]> = convert_2D_slices!(refs1 =>into SmallVec<[&mut [u8]; 32]>, SmallVec::with_capacity);