Struct cbor::decoder::Config [] [src]

pub struct Config {
    pub max_len_array: usize,
    pub max_len_bytes: usize,
    pub max_len_text: usize,
    pub max_size_map: usize,
    pub max_nesting: usize,
    pub skip_tags: bool,
    pub check_tags: bool,
}

Config contains various settings which limit resource consumption or enable certain validation options. Please note that the various maximum length/size values apply to an individual element only.

This is mainly to prevent attackers from providing CBOR values whose length is larger than the available memory. In combination the memory consumption can still become large and it is best to limit the incoming bytes to a specific upper bound, e.g. by using std::io::Take.

Fields

Maximum number of array elements

Maximum length of a byte string

Maximum length of a string

Maximum number of object fields

Maximum recursion steps when decoder Values

Ignore Tags when decoding Values

Validate Value type matches Tag.

Methods

impl Config
[src]

Create default configuration with

  • max_len_array = 1000
  • max_len_bytes = 5 MB
  • max_len_text = 5 MB
  • max_size_map = 1000
  • max_nesting = 16
  • skip_tags = false
  • check_tags = true

Trait Implementations

impl Clone for Config
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Config
[src]

Formats the value using the given formatter.

impl PartialEq for Config
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Config
[src]