pub struct BitfieldStruct {
pub name: String,
pub fields: Vec<BitField>,
}Expand description
Represents a complete bitfield structure definition.
Fields§
§name: StringThe name of the structure.
fields: Vec<BitField>The fields in the structure.
Implementations§
Source§impl BitfieldStruct
impl BitfieldStruct
Sourcepub fn add_field(
&mut self,
name: impl Into<String>,
bits: usize,
field_type: FieldType,
)
pub fn add_field( &mut self, name: impl Into<String>, bits: usize, field_type: FieldType, )
Add a field to the structure.
Sourcepub fn bit_size(&self, structs: &HashMap<String, BitfieldStruct>) -> usize
pub fn bit_size(&self, structs: &HashMap<String, BitfieldStruct>) -> usize
Calculate the total bit size of this structure.
Sourcepub fn byte_size(&self, structs: &HashMap<String, BitfieldStruct>) -> usize
pub fn byte_size(&self, structs: &HashMap<String, BitfieldStruct>) -> usize
Calculate the total byte size of this structure (rounded up).
Sourcepub fn field_bit_offset(
&self,
field_name: &str,
structs: &HashMap<String, BitfieldStruct>,
) -> Option<usize>
pub fn field_bit_offset( &self, field_name: &str, structs: &HashMap<String, BitfieldStruct>, ) -> Option<usize>
Get the bit offset of a field within the structure.
Trait Implementations§
Source§impl Clone for BitfieldStruct
impl Clone for BitfieldStruct
Source§fn clone(&self) -> BitfieldStruct
fn clone(&self) -> BitfieldStruct
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BitfieldStruct
impl Debug for BitfieldStruct
Source§impl PartialEq for BitfieldStruct
impl PartialEq for BitfieldStruct
impl Eq for BitfieldStruct
impl StructuralPartialEq for BitfieldStruct
Auto Trait Implementations§
impl Freeze for BitfieldStruct
impl RefUnwindSafe for BitfieldStruct
impl Send for BitfieldStruct
impl Sync for BitfieldStruct
impl Unpin for BitfieldStruct
impl UnwindSafe for BitfieldStruct
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