Skip to main content

aligned_vec

Macro aligned_vec 

Source
macro_rules! aligned_vec {
    () => { ... };
    ($elem:expr; $n:expr) => { ... };
    ($($x:expr),+ $(,)?) => { ... };
}
Expand description

Constructs an AlignedVec from a literal list of elements.

Syntax mirrors vec! from the standard library:

  • aligned_vec![1u32, 2, 3] — create from elements
  • aligned_vec![0u8; 64] — fill with n copies of a value

§Examples

use mnemosyne_arena::aligned_vec;
let v = aligned_vec![1u32, 2, 3];
assert_eq!(v.as_slice(), &[1, 2, 3]);

let zeros = aligned_vec![0u8; 8];
assert_eq!(zeros.len(), 8);
assert!(zeros.iter().all(|&b| b == 0));