#[non_exhaustive]#[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],
}Expand description
Describes a field in a struct or tuple
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.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
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
Implementations§
Source§impl Field
impl Field
Sourcepub const fn builder() -> FieldBuilder
pub const fn builder() -> FieldBuilder
Returns a builder for Field
Sourcepub fn has_sensitive_attr(&'static self) -> bool
pub fn has_sensitive_attr(&'static self) -> bool
Sourcepub fn get_rename_attr(&'static self) -> Option<&'static str>
pub fn get_rename_attr(&'static self) -> Option<&'static str>
Sourcepub fn get_default_attr(&'static self) -> Option<Option<DefaultInPlaceFn>>
pub fn get_default_attr(&'static self) -> Option<Option<DefaultInPlaceFn>>
Sourcepub fn maybe_default_fn(&'static self) -> Option<Option<DefaultInPlaceFn>>
pub fn maybe_default_fn(&'static self) -> Option<Option<DefaultInPlaceFn>>
Returns the default attribute if present
Sourcepub fn get_arbitrary_attr(&'static self) -> Option<&'static str>
pub fn get_arbitrary_attr(&'static self) -> Option<&'static str>
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
Trait Implementations§
impl Copy for Field
impl Eq for Field
impl StructuralPartialEq for Field
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