pub struct FieldAttrs {
pub default: Option<String>,
pub deserialize_with: Option<String>,
pub flatten: bool,
pub rename: Option<String>,
pub serialize_with: Option<String>,
pub skip_serializing_if: Option<String>,
}Fields§
§default: Option<String>Optional path to a function that will produce the default value in case the field is omitted from the serialized representation.
See also: https://serde.rs/field-attrs.html#default--path
An empty string may be used as value, in which case Default::default
is assumed. See also: https://serde.rs/field-attrs.html#default
deserialize_with: Option<String>Optional Serde dependency used for deserialization.
flatten: boolDetermines whether the field should be flattened into the parent struct.
rename: Option<String>Optional name to use in the serialized format (only used if different than the field name itself).
See also: https://serde.rs/field-attrs.html#rename
serialize_with: Option<String>Optional Serde dependency used for serialization.
skip_serializing_if: Option<String>Optional path to a function to determine whether serialized should be skipped for a particular value.
E.g.: can be used to omit Options by specifying
skip_serializing_if = "Option::is_none".
See also: https://serde.rs/field-attrs.html#skip_serializing_if
Implementations§
Source§impl FieldAttrs
impl FieldAttrs
pub fn from_attrs(attrs: &[Attribute]) -> Self
pub fn to_serde_attrs(&self) -> Vec<String>
Trait Implementations§
Source§impl Clone for FieldAttrs
impl Clone for FieldAttrs
Source§fn clone(&self) -> FieldAttrs
fn clone(&self) -> FieldAttrs
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FieldAttrs
impl Debug for FieldAttrs
Source§impl Default for FieldAttrs
impl Default for FieldAttrs
Source§fn default() -> FieldAttrs
fn default() -> FieldAttrs
Source§impl Hash for FieldAttrs
impl Hash for FieldAttrs
Source§impl Parse for FieldAttrs
impl Parse for FieldAttrs
fn parse(input: ParseStream<'_>) -> Result<Self>
Source§impl PartialEq for FieldAttrs
impl PartialEq for FieldAttrs
impl Eq for FieldAttrs
impl StructuralPartialEq for FieldAttrs
Auto Trait Implementations§
impl Freeze for FieldAttrs
impl RefUnwindSafe for FieldAttrs
impl Send for FieldAttrs
impl Sync for FieldAttrs
impl Unpin for FieldAttrs
impl UnwindSafe for FieldAttrs
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.