#[non_exhaustive]pub struct DeserializeOptions {
pub deny_unsupported_types: bool,
pub deny_recursive_tables: bool,
pub sort_keys: bool,
pub encode_empty_tables_as_array: bool,
pub detect_mixed_tables: bool,
}
serde
only.Expand description
A struct with options to change default deserializer behavior.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.deny_unsupported_types: bool
If true, an attempt to serialize types such as Function
, Thread
, LightUserData
and Error
will cause an error.
Otherwise these types skipped when iterating or serialized as unit type.
Default: true
deny_recursive_tables: bool
If true, an attempt to serialize a recursive table (table that refers to itself) will cause an error. Otherwise subsequent attempts to serialize the same table will be ignored.
Default: true
sort_keys: bool
If true, keys in tables will be iterated in sorted order.
Default: false
encode_empty_tables_as_array: bool
If true, empty Lua tables will be encoded as array, instead of map.
Default: false
detect_mixed_tables: bool
If true, enable detection of mixed tables.
A mixed table is a table that has both array-like and map-like entries or several borders.
See The Length Operator
documentation for details about borders.
When this option is disabled, a table with a non-zero length (with one or more borders) will be always encoded as an array.
Default: false
Implementations§
Source§impl Options
impl Options
Sourcepub const fn deny_unsupported_types(self, enabled: bool) -> Self
pub const fn deny_unsupported_types(self, enabled: bool) -> Self
Sets deny_unsupported_types
option.
Sourcepub const fn deny_recursive_tables(self, enabled: bool) -> Self
pub const fn deny_recursive_tables(self, enabled: bool) -> Self
Sets deny_recursive_tables
option.
Sourcepub const fn encode_empty_tables_as_array(self, enabled: bool) -> Self
pub const fn encode_empty_tables_as_array(self, enabled: bool) -> Self
Sets encode_empty_tables_as_array
option.
Sourcepub const fn detect_mixed_tables(self, enable: bool) -> Self
pub const fn detect_mixed_tables(self, enable: bool) -> Self
Sets detect_mixed_tables
option.
Trait Implementations§
impl Copy for Options
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more