Skip to main content

zset

Macro zset 

Source
macro_rules! zset {
    ( $( $key:expr_2021 => $weight:expr_2021 ),* $(,)?) => { ... };
}
Expand description

Create a Z-set with specified elements.

This macro is used in unit tests to create reference inputs and outputs. It generates a Z-set of type OrdZSets.

If all the elements in the Z-set will have weight 1, consider zset_set!.

ยงExample

The following example shows how to construct a Z-set with (key, weight) tuples (1, -1), (2, 1):

use dbsp::{zset, IndexedZSet, IndexedZSetReader};

let zset = zset! {1 => -1, 2 => 1};
assert_eq!(
    zset.iter().collect::<Vec<_>>(),
    vec![(1, (), -1), (2, (), 1)]
);