pub struct BitfieldSerializer {
pub structs: HashMap<String, BitfieldStruct>,
}Expand description
A serializer for bitfield structures.
Fields§
§structs: HashMap<String, BitfieldStruct>Registered bitfield structure definitions.
Implementations§
Source§impl BitfieldSerializer
impl BitfieldSerializer
Sourcepub fn register_struct(&mut self, bitfield_struct: BitfieldStruct)
pub fn register_struct(&mut self, bitfield_struct: BitfieldStruct)
Register a bitfield structure definition.
Sourcepub fn serialize(&self, value: &BitfieldValue) -> Result<Vec<u8>, String>
pub fn serialize(&self, value: &BitfieldValue) -> Result<Vec<u8>, String>
Serialize a bitfield value to bytes.
Sourcepub fn deserialize(
&self,
struct_name: &str,
data: &[u8],
) -> Result<BitfieldValue, String>
pub fn deserialize( &self, struct_name: &str, data: &[u8], ) -> Result<BitfieldValue, String>
Deserialize bytes to a bitfield value.
Sourcepub fn to_hex(&self, value: &BitfieldValue) -> Result<String, String>
pub fn to_hex(&self, value: &BitfieldValue) -> Result<String, String>
Serialize to a hexadecimal string.
Sourcepub fn from_hex(
&self,
struct_name: &str,
hex_str: &str,
) -> Result<BitfieldValue, String>
pub fn from_hex( &self, struct_name: &str, hex_str: &str, ) -> Result<BitfieldValue, String>
Deserialize from a hexadecimal string.
Trait Implementations§
Source§impl Clone for BitfieldSerializer
impl Clone for BitfieldSerializer
Source§fn clone(&self) -> BitfieldSerializer
fn clone(&self) -> BitfieldSerializer
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 BitfieldSerializer
impl Debug for BitfieldSerializer
Auto Trait Implementations§
impl Freeze for BitfieldSerializer
impl RefUnwindSafe for BitfieldSerializer
impl Send for BitfieldSerializer
impl Sync for BitfieldSerializer
impl Unpin for BitfieldSerializer
impl UnwindSafe for BitfieldSerializer
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