pub trait Header:
Clone
+ Sized
+ PartialEq
+ Eq
+ Debug {
// Required methods
fn total_size(&self) -> usize;
fn set_size(&mut self, total_size: usize);
// Provided method
fn payload_len(&self) -> usize { ... }
}Expand description
A sized header type for DynSizedStructure.
Note that header refers to the header pattern. Thus, depending on the use
case, this is not just a tag header. Instead, it refers to all bytes that
are fixed and not part of any optional terminating dynamic [u8] slice in a
DynSizedStructure.
The alignment of implementors must be the compatible with the demands
for the corresponding structure, which typically is ALIGNMENT.
Required Methods§
Sourcefn total_size(&self) -> usize
fn total_size(&self) -> usize
Returns the total size of the structure in bytes, including the fixed header and any dynamic payload.
Provided Methods§
Sourcefn payload_len(&self) -> usize
fn payload_len(&self) -> usize
Returns the length of the payload, i.e., the bytes that are additional to the header. The value is measured in bytes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".