pub enum SkipSerialization {
Never,
Null(bool),
Empty(bool),
}
Expand description
Defines behavior for skipping the serialization of fields.
This behavior is configured via the skip_serialization
attribute on fields of structs. It is
passed as parameter to ToValue::skip_serialization
of the corresponding field.
The default for fields in derived structs is SkipSerialization::Null(true)
, which will skips
null
values under the field recursively. Newtype structs (MyType(T)
) and enums pass through
to their inner type and variant, respectively.
§Example
#[derive(Debug, Empty, ToValue)]
struct Helper {
#[metastructure(skip_serialization = "never")]
items: Annotated<Array<String>>,
}
Variants§
Never
Serialize all values. Missing values will be serialized as null
.
Null(bool)
Do not serialize null
values but keep empty collections.
If the bool
flag is set to true
, this applies to all descendants recursively; if it is
set to false
, this only applies to direct children and does not propagate down.
Empty(bool)
Do not serialize empty objects as indicated by the Empty
trait.
If the bool
flag is set to true
, this applies to all descendants recursively; if it is
set to false
, this only applies to direct children and does not propagate down.
Implementations§
Trait Implementations§
source§impl Clone for SkipSerialization
impl Clone for SkipSerialization
source§fn clone(&self) -> SkipSerialization
fn clone(&self) -> SkipSerialization
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SkipSerialization
impl Debug for SkipSerialization
source§impl Default for SkipSerialization
impl Default for SkipSerialization
source§impl PartialEq for SkipSerialization
impl PartialEq for SkipSerialization
impl Copy for SkipSerialization
impl Eq for SkipSerialization
impl StructuralPartialEq for SkipSerialization
Auto Trait Implementations§
impl Freeze for SkipSerialization
impl RefUnwindSafe for SkipSerialization
impl Send for SkipSerialization
impl Sync for SkipSerialization
impl Unpin for SkipSerialization
impl UnwindSafe for SkipSerialization
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)