#[repr(C)]pub struct Field {
pub name: &'static str,
pub shape: &'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 str
key for the struct field (for tuples and tuple-structs, this is the 0-based index)
shape: &'static Shape
shape of the inner type
offset: usize
offset of the field in the struct (obtained through core::mem::offset_of
)
flags: FieldFlags
flags 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 FieldVTable
vtable for fields
flattened: bool
true 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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
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
Mutably borrows from an owned value. Read more