#[derive(Clone, Debug)]
pub struct Config {
pub compatible: bool,
pub xlang: bool,
pub share_meta: bool,
pub compress_string: bool,
pub check_string_read: bool,
pub max_dyn_depth: u32,
pub check_struct_version: bool,
pub track_ref: bool,
pub max_binary_size: u32,
pub max_collection_size: u32,
}
impl Default for Config {
fn default() -> Self {
Config {
compatible: false,
xlang: true,
share_meta: false,
compress_string: false,
check_string_read: true,
max_dyn_depth: 5,
check_struct_version: false,
track_ref: false,
max_binary_size: 64 * 1024 * 1024, max_collection_size: 1024 * 1024, }
}
}
impl Config {
pub fn new() -> Self {
Self::default()
}
#[inline(always)]
pub fn is_compatible(&self) -> bool {
self.compatible
}
#[inline(always)]
pub fn is_xlang(&self) -> bool {
self.xlang
}
#[inline(always)]
pub fn is_share_meta(&self) -> bool {
self.share_meta
}
#[inline(always)]
pub fn is_compress_string(&self) -> bool {
self.compress_string
}
#[inline(always)]
pub fn is_check_string_read(&self) -> bool {
self.check_string_read
}
#[inline(always)]
pub fn max_dyn_depth(&self) -> u32 {
self.max_dyn_depth
}
#[inline(always)]
pub fn is_check_struct_version(&self) -> bool {
self.check_struct_version
}
#[inline(always)]
pub fn is_track_ref(&self) -> bool {
self.track_ref
}
#[inline(always)]
pub fn max_binary_size(&self) -> u32 {
self.max_binary_size
}
#[inline(always)]
pub fn max_collection_size(&self) -> u32 {
self.max_collection_size
}
}