pub struct Header {
pub magic: u32,
pub version: u8,
pub coder: u8,
pub original_len: u64,
pub crc32: u32,
}Expand description
Header structure for compressed data files.
Layout (18 bytes total):
- magic: 4 bytes (little-endian u32)
- version: 1 byte
- coder: 1 byte (0=AC, 1=rANS)
- original_len: 8 bytes (little-endian u64)
- crc32: 4 bytes (little-endian u32)
Fields§
§magic: u32Magic number for format identification (must be MAGIC).
version: u8Format version for compatibility checking.
coder: u8Coder type used (0=AC, 1=rANS).
original_len: u64Original uncompressed data length in bytes.
crc32: u32CRC32 checksum of original data for integrity verification.
Implementations§
Source§impl Header
impl Header
Sourcepub fn new(coder: CoderType, original_len: u64, crc32: u32) -> Self
pub fn new(coder: CoderType, original_len: u64, crc32: u32) -> Self
Create a new header for compressed data.
Sourcepub fn write<W: Write>(&self, w: &mut W) -> Result<()>
pub fn write<W: Write>(&self, w: &mut W) -> Result<()>
Serialize header to a writer (little-endian format).
Sourcepub fn read<R: Read>(r: &mut R) -> Result<Self>
pub fn read<R: Read>(r: &mut R) -> Result<Self>
Deserialize header from a reader (little-endian format).
Sourcepub fn coder_type(&self) -> CoderType
pub fn coder_type(&self) -> CoderType
Get the coder type from the header byte.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more