1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! This crate provides several command line tools and functions for converting
//! ensembles of districting plans contained in a JSONL file with lines of the
//! form
//!
//! ```text
//! {"assignment": <assignment>, "sample": <sample>}
//! ```
//!
//! into binary ensembles (BEN) and extremely compressed binary ensembles
//! (XBEN). It also provides several tools for working with these files
//! including several tools for relabeling the ensembles to improve
//! compression ratios.
//!
//! The main CLI tools provided by this crate are:
//!
//! - `ben`: A tool for converting JSONL files into BEN files.
//!    and for converting between BEN and XBEN files.
//! - `reben`: A tool for relabeling BEN files to improve compression ratios.
//!

pub mod decode;
pub mod encode;
pub mod utils;

#[macro_export]
macro_rules! log {
    ($($arg:tt)*) => {{
        if let Ok(log_level) = std::env::var("RUST_LOG") {
            if log_level.to_lowercase() == "trace" {
                eprint!($($arg)*);
            }
        }
    }}
}

#[macro_export]
macro_rules! logln {
    ($($arg:tt)*) => {{
        if let Ok(log_level) = std::env::var("RUST_LOG") {
            if log_level.to_lowercase() == "trace" {
                eprintln!($($arg)*);
            }
        }
    }}
}