pub struct Field {
pub name: Option<Symbol>,
pub ty: TypeId,
pub offset: u64,
pub bits: Option<u32>,
}Expand description
One member of a record, placed.
Fields§
§name: Option<Symbol>The member name, absent for an unnamed bit-field or an anonymous member.
ty: TypeIdThe member type.
offset: u64Where the member starts, in bits from the start of the record.
Bits rather than bytes because a bit-field does not start on a byte boundary, and one unit for both kinds of member beats two that have to be kept in step.
bits: Option<u32>The bit-field width, absent when the member is an ordinary one.
Implementations§
Source§impl Field
impl Field
Sourcepub fn byte_offset(&self) -> u64
pub fn byte_offset(&self) -> u64
Where the member starts in bytes, rounded down.
For an ordinary member this is exactly where it starts. For a bit-field it is the byte the first of its bits lives in, which is a starting point for a load rather than an address the program may take.
Sourcepub fn is_bit_field(&self) -> bool
pub fn is_bit_field(&self) -> bool
Whether the member is a bit-field, zero width included.
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 UnsafeUnpin 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