pub struct EncoderConfig {
pub validate_canonical: bool,
pub sort_fields: bool,
pub text_input_mode: TextInputMode,
pub semantic_dictionary: Option<SemanticDictionary>,
pub enable_nested_binary: bool,
pub max_depth: usize,
pub streaming_mode: bool,
pub delta_mode: bool,
pub chunk_size: usize,
}Expand description
Configuration for binary encoding
Fields§
§validate_canonical: boolWhether to validate canonical form before encoding
sort_fields: boolWhether to sort fields by FID (ensures canonical binary)
text_input_mode: TextInputModeHow to preprocess incoming text before parsing
semantic_dictionary: Option<SemanticDictionary>Optional semantic dictionary for value normalization prior to encoding
enable_nested_binary: boolWhether to enable nested binary structure encoding (v0.5)
max_depth: usizeMaximum nesting depth for nested structures (v0.5)
streaming_mode: boolWhether to enable streaming mode for large payloads (v0.5)
delta_mode: boolWhether to enable delta encoding mode (v0.5)
chunk_size: usizeChunk size for streaming mode in bytes (v0.5)
Implementations§
Source§impl EncoderConfig
impl EncoderConfig
Sourcepub fn with_validate_canonical(self, validate: bool) -> Self
pub fn with_validate_canonical(self, validate: bool) -> Self
Sets whether to validate canonical form before encoding
Sourcepub fn with_sort_fields(self, sort: bool) -> Self
pub fn with_sort_fields(self, sort: bool) -> Self
Sets whether to sort fields by FID
Sourcepub fn with_text_input_mode(self, mode: TextInputMode) -> Self
pub fn with_text_input_mode(self, mode: TextInputMode) -> Self
Sets how text input should be pre-processed before parsing.
Sourcepub fn with_semantic_dictionary(self, dict: SemanticDictionary) -> Self
pub fn with_semantic_dictionary(self, dict: SemanticDictionary) -> Self
Attaches a semantic dictionary for normalization prior to encoding.
Sourcepub fn with_nested_binary(self, enable: bool) -> Self
pub fn with_nested_binary(self, enable: bool) -> Self
Enables nested binary structure encoding (v0.5)
Sourcepub fn with_max_depth(self, depth: usize) -> Self
pub fn with_max_depth(self, depth: usize) -> Self
Sets maximum nesting depth for nested structures (v0.5)
Sourcepub fn with_streaming_mode(self, enable: bool) -> Self
pub fn with_streaming_mode(self, enable: bool) -> Self
Enables streaming mode for large payloads (v0.5)
Sourcepub fn with_delta_mode(self, enable: bool) -> Self
pub fn with_delta_mode(self, enable: bool) -> Self
Enables delta encoding mode (v0.5)
Sourcepub fn with_chunk_size(self, size: usize) -> Self
pub fn with_chunk_size(self, size: usize) -> Self
Sets chunk size for streaming mode in bytes (v0.5)
Sourcepub fn with_v0_4_compatibility(self) -> Self
pub fn with_v0_4_compatibility(self) -> Self
Configures the encoder for v0.4 compatibility mode
This disables all v0.5 features (nested structures, streaming, delta encoding) to ensure the output is compatible with v0.4 decoders.
§Examples
use lnmp_codec::binary::EncoderConfig;
let config = EncoderConfig::new().with_v0_4_compatibility();
assert!(!config.enable_nested_binary);
assert!(!config.streaming_mode);
assert!(!config.delta_mode);Trait Implementations§
Source§impl Clone for EncoderConfig
impl Clone for EncoderConfig
Source§fn clone(&self) -> EncoderConfig
fn clone(&self) -> EncoderConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more