pub struct U24(/* private fields */);Expand description
Represents a 24-bit unsigned integer (U24), supporting SV2 serialization and deserialization.
Only first 3 bytes of a u32 is considered to get the SV2 value, and rest are ignored (in little
endian).
Trait Implementations§
Source§impl<'a> Decodable<'a> for U24
impl<'a> Decodable<'a> for U24
Source§fn get_structure(_: &[u8]) -> Result<Vec<FieldMarker>, Error>
fn get_structure(_: &[u8]) -> Result<Vec<FieldMarker>, Error>
Defines the expected structure of a type based on binary data. Read more
Source§fn from_decoded_fields(data: Vec<DecodableField<'a>>) -> Result<Self, Error>
fn from_decoded_fields(data: Vec<DecodableField<'a>>) -> Result<Self, Error>
Constructs the type from a vector of decoded fields. Read more
Source§impl From<U24> for EncodableField<'_>
impl From<U24> for EncodableField<'_>
Source§impl From<U24> for FieldMarker
impl From<U24> for FieldMarker
Source§impl GetMarker for U24
impl GetMarker for U24
Source§fn get_marker() -> FieldMarker
fn get_marker() -> FieldMarker
Defines the structure of a type for decoding purposes, supporting both primitive and
structured types. It helps getting a marker for a type.
Source§impl<'a> Sv2DataType<'a> for U24
impl<'a> Sv2DataType<'a> for U24
Source§fn from_bytes_unchecked(data: &'a mut [u8]) -> Self
fn from_bytes_unchecked(data: &'a mut [u8]) -> Self
Constructs an instance from a mutable byte slice without verifying size constraints.
Source§fn from_vec_(data: Vec<u8>) -> Result<Self, Error>
fn from_vec_(data: Vec<u8>) -> Result<Self, Error>
Constructs an instance from a vector, checking for the correct size.
Source§fn from_vec_unchecked(data: Vec<u8>) -> Self
fn from_vec_unchecked(data: Vec<u8>) -> Self
Constructs an instance from a vector without validating its size.
Source§fn to_slice_unchecked(&'a self, dst: &mut [u8])
fn to_slice_unchecked(&'a self, dst: &mut [u8])
Serializes the instance to a mutable slice without checking the destination size.
Source§impl<'a> TryFrom<DecodableField<'a>> for U24
impl<'a> TryFrom<DecodableField<'a>> for U24
Source§impl<'a> TryFrom<EncodableField<'a>> for U24
impl<'a> TryFrom<EncodableField<'a>> for U24
impl Copy for U24
impl Eq for U24
impl StructuralPartialEq for U24
Auto Trait Implementations§
impl Freeze for U24
impl RefUnwindSafe for U24
impl Send for U24
impl Sync for U24
impl Unpin for U24
impl UnwindSafe for U24
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, T> Encodable for Twhere
T: Into<EncodableField<'a>>,
impl<'a, T> Encodable for Twhere
T: Into<EncodableField<'a>>,
Source§impl<T> SizeHint for Twhere
T: Fixed,
impl<T> SizeHint for Twhere
T: Fixed,
Source§fn size_hint(_data: &[u8], _offset: usize) -> Result<usize, Error>
fn size_hint(_data: &[u8], _offset: usize) -> Result<usize, Error>
size_hint is a static method that takes the raw data and an offset and returns the total
size of the encoded message. This is particularly useful for types where the encoded size
may vary based on the contents of the data, and we need to calculate how much space is
required for decoding.