pub struct BasicHeader { /* private fields */ }
Expand description
Indicates the chunk stream and message header’s format. This header has 3 types.
Total Length | Message Header Format | Chunk ID | Chunk ID Range |
---|---|---|---|
8 | 2 | 6 | 0 - 63 |
16 | 2 | 8 | 64 - 319 |
24 | 2 | 16 | 64 - 65599 |
Unit of every item is bits. Basic header which is and above 16 bits has a flag bits in first 8 bits. It means whether chunk ID is 16 bits. Note if chunk ID is 16 bits, encoding/decoding it as Little Endian is required.
Any Chunk ID which is and above 64 is required to add/subtract 64 from it when reading/writing. This means to compensate a 6 bits which were replaced with the flag.
Implementations§
Source§impl BasicHeader
impl BasicHeader
Sourcepub fn new(message_format: MessageFormat, chunk_id: u16) -> Self
pub fn new(message_format: MessageFormat, chunk_id: u16) -> Self
Constructs a new basic header.
Sourcepub fn get_message_format(&self) -> MessageFormat
pub fn get_message_format(&self) -> MessageFormat
Gets the message format.
Sourcepub fn get_chunk_id(&self) -> u16
pub fn get_chunk_id(&self) -> u16
Gets the chunk ID.
Trait Implementations§
Source§impl Clone for BasicHeader
impl Clone for BasicHeader
Source§fn clone(&self) -> BasicHeader
fn clone(&self) -> BasicHeader
Returns a copy 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 BasicHeader
impl Debug for BasicHeader
impl Copy for BasicHeader
Auto Trait Implementations§
impl Freeze for BasicHeader
impl RefUnwindSafe for BasicHeader
impl Send for BasicHeader
impl Sync for BasicHeader
impl Unpin for BasicHeader
impl UnwindSafe for BasicHeader
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