pub struct Config {
pub limit: Option<usize>,
pub variable_int_encoding: bool,
}Expand description
Configuration options for justcode encoding/decoding.
Fields§
§limit: Option<usize>Maximum size limit for deserialization (prevents memory exhaustion attacks).
If None, no limit is enforced.
variable_int_encoding: boolUse variable-length integer encoding for lengths and enum variants. When enabled, small values use fewer bytes.
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Set a maximum size limit for deserialization.
This helps prevent memory exhaustion attacks by limiting the amount of memory that can be allocated during decoding.
Sourcepub fn with_variable_int_encoding(self, enabled: bool) -> Self
pub fn with_variable_int_encoding(self, enabled: bool) -> Self
Enable or disable variable-length integer encoding.
When enabled, small integers and lengths are encoded using fewer bytes (varint encoding). This is enabled by default.
Trait Implementations§
impl Copy for Config
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more