#[repr(C, packed(1))]pub struct VarDataHeader {
pub length: u16,
}Expand description
Variable-length data header.
The var data header precedes variable-length data fields and contains the length of the data that follows.
§Wire Format
+0: length (u16, 2 bytes) - for standard varDataEncodingNote: Some schemas may use u8 or u32 for the length field.
Fields§
§length: u16Length of the variable data in bytes.
Implementations§
Source§impl VarDataHeader
impl VarDataHeader
Sourcepub const ENCODED_LENGTH: usize = 2
pub const ENCODED_LENGTH: usize = 2
Encoded length of the var data header in bytes (u16 length).
Sourcepub const fn new(length: u16) -> Self
pub const fn new(length: u16) -> Self
Creates a new var data header with the specified length.
§Arguments
length- Length of the variable data in bytes
Sourcepub fn encode<B: WriteBuffer + ?Sized>(&self, buffer: &mut B, offset: usize)
pub fn encode<B: WriteBuffer + ?Sized>(&self, buffer: &mut B, offset: usize)
Encodes the var data header to the buffer at the given offset.
§Arguments
buffer- Buffer to write tooffset- Byte offset to start writing
Sourcepub const fn total_size(&self) -> usize
pub const fn total_size(&self) -> usize
Returns the total size (header + data).
Trait Implementations§
Source§impl Clone for VarDataHeader
impl Clone for VarDataHeader
Source§fn clone(&self) -> VarDataHeader
fn clone(&self) -> VarDataHeader
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 VarDataHeader
impl Debug for VarDataHeader
Source§impl Default for VarDataHeader
impl Default for VarDataHeader
Source§fn default() -> VarDataHeader
fn default() -> VarDataHeader
Returns the “default value” for a type. Read more
Source§impl PartialEq for VarDataHeader
impl PartialEq for VarDataHeader
impl Copy for VarDataHeader
impl Eq for VarDataHeader
impl StructuralPartialEq for VarDataHeader
Auto Trait Implementations§
impl Freeze for VarDataHeader
impl RefUnwindSafe for VarDataHeader
impl Send for VarDataHeader
impl Sync for VarDataHeader
impl Unpin for VarDataHeader
impl UnwindSafe for VarDataHeader
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