pub struct Block {
pub block_index: u64,
pub block_kind: u8,
pub codec_id: u16,
pub scale_bits: u8,
pub state_count: u8,
pub uncompressed_length: u32,
pub payload: Vec<u8>,
pub model_data: Vec<u8>,
pub payload_sha256: [u8; 32],
pub decoded_sha256: [u8; 32],
}Expand description
A decoded block record.
Fields§
§block_index: u64§block_kind: u8§codec_id: u16§scale_bits: u8§state_count: u8§uncompressed_length: u32§payload: Vec<u8>§model_data: Vec<u8>§payload_sha256: [u8; 32]§decoded_sha256: [u8; 32]Implementations§
Source§impl Block
impl Block
Sourcepub fn new_rans(
block_index: u64,
codec_id: u16,
scale_bits: u8,
state_count: u8,
uncompressed_length: u32,
payload: Vec<u8>,
model_data: Vec<u8>,
) -> Self
pub fn new_rans( block_index: u64, codec_id: u16, scale_bits: u8, state_count: u8, uncompressed_length: u32, payload: Vec<u8>, model_data: Vec<u8>, ) -> Self
Create a new RANS block.
Sourcepub fn header_to_bytes(&self) -> Vec<u8> ⓘ
pub fn header_to_bytes(&self) -> Vec<u8> ⓘ
Serialize block header to bytes (104 bytes).
Sourcepub fn parse_header(
bytes: &[u8],
expected_index: u64,
) -> Result<(BlockHeaderInfo, usize), AppError>
pub fn parse_header( bytes: &[u8], expected_index: u64, ) -> Result<(BlockHeaderInfo, usize), AppError>
Parse a block header from bytes. Returns the header + number of bytes consumed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnsafeUnpin for Block
impl UnwindSafe for Block
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