pub struct Header {
pub magic: [u8; 4],
pub version_major: u8,
pub version_minor: u8,
pub flags: u16,
}Expand description
PARX file header structure (16 bytes total).
Layout:
- bytes 0-3: magic (“PARX”)
- byte 4: version_major
- byte 5: version_minor
- bytes 6-7: flags (little-endian)
- bytes 8-15: reserved
Fields§
§magic: [u8; 4]§version_major: u8§version_minor: u8§flags: u16Implementations§
Source§impl Header
impl Header
Sourcepub const fn from_bytes(bytes: &[u8; 16]) -> Self
pub const fn from_bytes(bytes: &[u8; 16]) -> Self
Parse header from bytes.
Sourcepub fn is_magic_valid(&self, expected_magic: [u8; 4]) -> bool
pub fn is_magic_valid(&self, expected_magic: [u8; 4]) -> bool
Check if magic matches expected value.
Sourcepub const fn is_version_supported(&self) -> bool
pub const fn is_version_supported(&self) -> bool
Check if version is supported.
Check if the footer is compressed.
Sourcepub const fn compression_algorithm(&self) -> Option<Compression>
pub const fn compression_algorithm(&self) -> Option<Compression>
Get the compression algorithm, if footer is compressed.
Sourcepub fn set_compression(&mut self, compression: Compression)
pub fn set_compression(&mut self, compression: Compression)
Set the compression algorithm (also sets the compressed flag).
Sourcepub fn clear_compression(&mut self)
pub fn clear_compression(&mut self)
Clear compression (footer is uncompressed).
Trait Implementations§
impl Copy for Header
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin 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