pub mod api;
pub mod filters;
pub mod value;
pub use api::{Filter, FilterChain, HEADER_LEN, MAGIC, MAX_DECODED_BYTES, VERSION};
pub use filters::{Crc32, Lz4};
pub use value::{decode, encode, type_tag};
pub const DEFAULT_CHAIN_ID: u8 = 1;
pub const CHECKSUM_ONLY_CHAIN_ID: u8 = 2;
pub fn default_chain() -> FilterChain {
FilterChain::new(DEFAULT_CHAIN_ID, vec![Box::new(Lz4), Box::new(Crc32)])
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_default_chain_is_lz4_then_crc32() {
assert_eq!(default_chain().describe(), "chain 1 (lz4 -> crc32)");
}
#[test]
fn the_default_chain_does_not_collide_with_raw() {
assert_ne!(FilterChain::raw().id(), default_chain().id());
}
}