Skip to main content

seq_vec

Macro seq_vec 

Source
macro_rules! seq_vec {
    () => { ... };
    ($([$($elem:expr),* $(,)?]),* $(,)?) => { ... };
}
Expand description

Creates a LESeqVec containing the given sequences.

This macro constructs a SeqVec with little-endian encoding and automatic codec selection, using the default u64 word type for storage.

§Examples

use compressed_intvec::seq_vec;

let v = seq_vec![[1u32, 2, 3], [10u32, 20], [100u32]];
assert_eq!(v.num_sequences(), 3);
assert_eq!(v.get(0).unwrap().collect::<Vec<_>>(), vec![1u32, 2, 3]);
assert_eq!(v.get(1).unwrap().collect::<Vec<_>>(), vec![10u32, 20]);
assert_eq!(v.get(2).unwrap().collect::<Vec<_>>(), vec![100u32]);

§Notes

  • Empty sequences are supported: seq_vec![[1, 2], [], [3]].
  • All elements in a sequence must be the same type.
  • The macro uses from_slices internally, which performs codec analysis.