#[non_exhaustive]#[repr(C)]pub struct Field<'shape> {
pub name: &'shape str,
pub shape: &'shape Shape<'shape>,
pub offset: usize,
pub flags: FieldFlags,
pub attributes: &'shape [FieldAttribute<'shape>],
pub doc: &'shape [&'shape str],
pub vtable: &'shape FieldVTable,
pub flattened: bool,
}Expand description
Describes a field in a struct or tuple
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.name: &'shape strkey for the struct field (for tuples and tuple-structs, this is the 0-based index)
shape: &'shape Shape<'shape>shape of the inner type
offset: usizeoffset of the field in the struct (obtained through core::mem::offset_of)
flags: FieldFlagsflags for the field (e.g. sensitive, etc.)
attributes: &'shape [FieldAttribute<'shape>]arbitrary attributes set via the derive macro
doc: &'shape [&'shape str]doc comments
vtable: &'shape FieldVTablevtable for fields
flattened: booltrue if returned from fields_for_serialize and it was flattened - which
means, if it’s an enum, the outer variant shouldn’t be written.
Implementations§
Source§impl Field<'_>
impl Field<'_>
Sourcepub unsafe fn should_skip_serializing(&self, ptr: PtrConst<'_>) -> bool
pub unsafe fn should_skip_serializing(&self, ptr: PtrConst<'_>) -> bool
Returns true if the field has the skip-serializing unconditionally flag or if it has the skip-serializing-if function in its vtable and it returns true on the given data.
§Safety
The peek should correspond to a value of the same type as this field
Source§impl<'shape> Field<'shape>
impl<'shape> Field<'shape>
Sourcepub const fn builder() -> FieldBuilder<'shape>
pub const fn builder() -> FieldBuilder<'shape>
Returns a builder for Field
Sourcepub fn is_sensitive(&'static self) -> bool
pub fn is_sensitive(&'static self) -> bool
Checks if field is marked as sensitive through attributes or flags