EncoderConfig

Struct EncoderConfig 

Source
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: bool

Whether to validate canonical form before encoding

§sort_fields: bool

Whether to sort fields by FID (ensures canonical binary)

§text_input_mode: TextInputMode

How to preprocess incoming text before parsing

§semantic_dictionary: Option<SemanticDictionary>

Optional semantic dictionary for value normalization prior to encoding

§enable_nested_binary: bool

Whether to enable nested binary structure encoding (v0.5)

§max_depth: usize

Maximum nesting depth for nested structures (v0.5)

§streaming_mode: bool

Whether to enable streaming mode for large payloads (v0.5)

§delta_mode: bool

Whether to enable delta encoding mode (v0.5)

§chunk_size: usize

Chunk size for streaming mode in bytes (v0.5)

Implementations§

Source§

impl EncoderConfig

Source

pub fn new() -> Self

Creates a new encoder configuration with default settings

Source

pub fn with_validate_canonical(self, validate: bool) -> Self

Sets whether to validate canonical form before encoding

Source

pub fn with_sort_fields(self, sort: bool) -> Self

Sets whether to sort fields by FID

Source

pub fn with_text_input_mode(self, mode: TextInputMode) -> Self

Sets how text input should be pre-processed before parsing.

Source

pub fn with_semantic_dictionary(self, dict: SemanticDictionary) -> Self

Attaches a semantic dictionary for normalization prior to encoding.

Source

pub fn with_nested_binary(self, enable: bool) -> Self

Enables nested binary structure encoding (v0.5)

Source

pub fn with_max_depth(self, depth: usize) -> Self

Sets maximum nesting depth for nested structures (v0.5)

Source

pub fn with_streaming_mode(self, enable: bool) -> Self

Enables streaming mode for large payloads (v0.5)

Source

pub fn with_delta_mode(self, enable: bool) -> Self

Enables delta encoding mode (v0.5)

Source

pub fn with_chunk_size(self, size: usize) -> Self

Sets chunk size for streaming mode in bytes (v0.5)

Source

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

Source§

fn clone(&self) -> EncoderConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EncoderConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EncoderConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.