#[repr(C)]pub struct Field {
pub name: &'static str,
pub shape: fn() -> &'static Shape,
pub offset: usize,
pub flags: FieldFlags,
pub attributes: &'static [FieldAttribute],
pub doc: &'static [&'static str],
pub vtable: &'static FieldVTable,
pub flattened: bool,
}Expand description
Describes a field in a struct or tuple
Fields§
§name: &'static strkey for the struct field (for tuples and tuple-structs, this is the 0-based index)
shape: fn() -> &'static Shapeshape of the inner type
the layer of indirection allows for cyclic type definitions
offset: usizeoffset of the field in the struct (obtained through core::mem::offset_of)
flags: FieldFlagsflags for the field (e.g. sensitive, etc.)
attributes: &'static [FieldAttribute]arbitrary attributes set via the derive macro
doc: &'static [&'static str]doc comments
vtable: &'static 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