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,
}Expand description
Configuration for Fory serialization.
This struct holds all the configuration options that control how Fory
serializes and deserializes data. It is shared between the main Fory
instance and the WriteContext/ReadContext to ensure consistent behavior.
Fields§
§compatible: boolWhether compatible mode is enabled for schema evolution support.
xlang: boolWhether xlang mode is enabled.
Whether metadata sharing is enabled.
compress_string: boolWhether meta string compression is enabled.
check_string_read: boolWhether UTF-8 string payloads are validated before constructing Rust strings.
max_dyn_depth: u32Maximum depth for nested dynamic object serialization.
check_struct_version: boolWhether class version checking is enabled.
track_ref: boolWhether reference tracking is enabled. When enabled, shared references and circular references are tracked and preserved during serialization/deserialization.
max_binary_size: u32Maximum allowed size for binary data in bytes. Prevents excessive memory allocation from untrusted payloads.
max_collection_size: u32Maximum allowed number of elements in a collection or entries in a map. Prevents excessive memory allocation from untrusted payloads.
Implementations§
Source§impl Config
impl Config
Sourcepub fn is_compatible(&self) -> bool
pub fn is_compatible(&self) -> bool
Check if compatible mode is enabled.
Check if meta sharing is enabled.
Sourcepub fn is_compress_string(&self) -> bool
pub fn is_compress_string(&self) -> bool
Check if string compression is enabled.
Sourcepub fn is_check_string_read(&self) -> bool
pub fn is_check_string_read(&self) -> bool
Check if UTF-8 string payload validation is enabled.
Sourcepub fn max_dyn_depth(&self) -> u32
pub fn max_dyn_depth(&self) -> u32
Get maximum dynamic depth.
Sourcepub fn is_check_struct_version(&self) -> bool
pub fn is_check_struct_version(&self) -> bool
Check if class version checking is enabled.
Sourcepub fn is_track_ref(&self) -> bool
pub fn is_track_ref(&self) -> bool
Check if reference tracking is enabled.
Sourcepub fn max_binary_size(&self) -> u32
pub fn max_binary_size(&self) -> u32
Get maximum allowed binary data size in bytes.
Sourcepub fn max_collection_size(&self) -> u32
pub fn max_collection_size(&self) -> u32
Get maximum allowed collection/map element count.