pub struct BlockHeader {
pub last_block: bool,
pub block_type: BlockType,
pub block_size: usize,
}Expand description
Parsed block header.
Fields§
§last_block: boolWhether this is the last block in the frame.
block_type: BlockTypeBlock type.
block_size: usizeBlock size in bytes. For Raw: size of uncompressed data For RLE: decompressed size (compressed is 1 byte) For Compressed: size of compressed data
Implementations§
Source§impl BlockHeader
impl BlockHeader
Sourcepub const MAX_BLOCK_SIZE: usize
pub const MAX_BLOCK_SIZE: usize
Maximum block size (128 KB - 1).
Sourcepub fn parse(data: &[u8]) -> Result<Self>
pub fn parse(data: &[u8]) -> Result<Self>
Parse a block header from 3 bytes.
Byte 0-2 (little-endian):
Bit 0: Last_Block flag
Bits 1-2: Block_Type
Bits 3-23: Block_Size (21 bits)Sourcepub fn compressed_size(&self) -> usize
pub fn compressed_size(&self) -> usize
Get the size of compressed data to read. For RLE blocks, this is 1 (the byte to repeat).
Sourcepub fn decompressed_size(&self) -> usize
pub fn decompressed_size(&self) -> usize
Get the size of decompressed output.
Trait Implementations§
Source§impl Clone for BlockHeader
impl Clone for BlockHeader
Source§fn clone(&self) -> BlockHeader
fn clone(&self) -> BlockHeader
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 BlockHeader
impl Debug for BlockHeader
Source§impl PartialEq for BlockHeader
impl PartialEq for BlockHeader
impl Copy for BlockHeader
impl Eq for BlockHeader
impl StructuralPartialEq for BlockHeader
Auto Trait Implementations§
impl Freeze for BlockHeader
impl RefUnwindSafe for BlockHeader
impl Send for BlockHeader
impl Sync for BlockHeader
impl Unpin for BlockHeader
impl UnwindSafe for BlockHeader
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