#[derive(Clone, Copy, Debug, Default)]
pub struct Config {
pub limit: Option<usize>,
pub use_varint: bool,
pub allow_trailing: bool,
}
pub fn standard() -> Config { Config { limit: None, use_varint: false, allow_trailing: false } }
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 }
}