serde_brief/config.rs
1//! Configuration for (de-)serialization.
2
3use ::core::num::NonZeroUsize;
4
5// TODO:
6// - Add max sequence/map size limit.
7// - Add max-depth limit.
8/// Configuration for (de-)serialization.
9#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
10pub struct Config {
11 /// Whether to use indices instead of strings as keys for struct-fields/enum-variants.
12 pub use_indices: bool,
13 /// Whether to return an error if there is excess data in the input.
14 pub error_on_excess_data: bool,
15 /// Maximum number of bytes to read or write, in any limit.
16 pub max_size: Option<NonZeroUsize>,
17}
18
19impl Default for Config {
20 fn default() -> Self {
21 Self { use_indices: false, error_on_excess_data: true, max_size: None }
22 }
23}