sint_vec

Macro sint_vec 

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

Creates a LESIntVec (an IntVec of i64s) containing the given elements.

sint_vec! allows for concise initialization of a LESIntVec, which is an alias for IntVec<i64, LE>. It uses a set of reasonable defaults:

  • Codec: VariableCodecSpec::Auto is used to automatically select the best codec based on the data’s properties (via zig-zag encoding).
  • Sampling Rate (k): A default value of 16 is used.

§Note on Types

All input elements are automatically cast to i64.

For more control over these parameters, or to use a different integer type, please use the IntVec::builder.

§Examples

Create an empty LESIntVec:

let v: LESIntVec = sint_vec![];
assert!(v.is_empty());

Create an LESIntVec from a list of elements:

  let v: LESIntVec = sint_vec![-100, 200, -300];
assert_eq!(v.len(), 3);
assert_eq!(v.get(2), Some(-300));

Create an LESIntVec with a repeated element:

  let v: LESIntVec = sint_vec![-42; 100];
assert_eq!(v.len(), 100);
assert_eq!(v.get(50), Some(-42));