const DEFAULT_MAX_RECURSION: usize = 50;
const DEFAULT_CHECK_KEY_SORT: bool = false;
const DEFAULT_ENFORCE_FULL_DECODE: bool = true;
#[derive(Copy, Clone)]
#[allow(clippy::module_name_repetitions)]
pub struct BDecodeOpt {
max_recursion: usize,
check_key_sort: bool,
enforce_full_decode: bool,
}
impl BDecodeOpt {
#[must_use]
pub fn new(max_recursion: usize, check_key_sort: bool, enforce_full_decode: bool) -> BDecodeOpt {
BDecodeOpt {
max_recursion,
check_key_sort,
enforce_full_decode,
}
}
#[must_use]
pub fn max_recursion(&self) -> usize {
self.max_recursion
}
#[must_use]
pub fn check_key_sort(&self) -> bool {
self.check_key_sort
}
#[must_use]
pub fn enforce_full_decode(&self) -> bool {
self.enforce_full_decode
}
}
impl Default for BDecodeOpt {
fn default() -> BDecodeOpt {
BDecodeOpt::new(DEFAULT_MAX_RECURSION, DEFAULT_CHECK_KEY_SORT, DEFAULT_ENFORCE_FULL_DECODE)
}
}