rawbin 1.0.0

Minimal, pure-Rust bincode-like serializer/deserializer used by pacm.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[derive(Clone, Copy, Debug, Default)]
pub struct Config {
    pub limit: Option<usize>,
    pub use_varint: bool,
    pub allow_trailing: bool,
}

/// Standard fixed-width encoding config
pub fn standard() -> Config { Config { limit: None, use_varint: false, allow_trailing: false } }

/// Legacy varint length encoding config
pub fn legacy() -> Config { Config { limit: None, use_varint: true, allow_trailing: false } }

impl Config {
    pub fn with_limit<const N: usize>(mut self) -> Self { self.limit = Some(N); self }
    pub fn allow_trailing_bytes(mut self) -> Self { self.allow_trailing = true; self }
    pub fn with_varint_encoding(mut self) -> Self { self.use_varint = true; self }
}