#[repr(C)]pub struct AprV2Header {
pub magic: [u8; 4],
pub version: (u8, u8),
pub flags: AprV2Flags,
pub tensor_count: u32,
pub metadata_offset: u64,
pub metadata_size: u32,
pub tensor_index_offset: u64,
pub data_offset: u64,
pub checksum: u32,
pub reserved: [u8; 20],
}Expand description
APR file header (64 bytes)
Fields§
§magic: [u8; 4]Magic number (“APR\0”) - ONE format, no versioning
version: (u8, u8)Format version (major, minor)
flags: AprV2FlagsFeature flags
tensor_count: u32Number of tensors
metadata_offset: u64Offset to JSON metadata section
metadata_size: u32Size of metadata in bytes
tensor_index_offset: u64Offset to tensor index
data_offset: u64Offset to tensor data
checksum: u32Header checksum (CRC32)
reserved: [u8; 20]Reserved for future use (zero-padded)
Implementations§
Source§impl AprV2Header
impl AprV2Header
Sourcepub fn from_bytes(buf: &[u8]) -> Result<Self, V2FormatError>
pub fn from_bytes(buf: &[u8]) -> Result<Self, V2FormatError>
Sourcepub fn compute_checksum(&self) -> u32
pub fn compute_checksum(&self) -> u32
Compute header checksum (CRC32 of header bytes excluding checksum field)
Sourcepub fn update_checksum(&mut self)
pub fn update_checksum(&mut self)
Update checksum field
Sourcepub fn verify_checksum(&self) -> bool
pub fn verify_checksum(&self) -> bool
Verify header checksum
Trait Implementations§
Source§impl Clone for AprV2Header
impl Clone for AprV2Header
Source§fn clone(&self) -> AprV2Header
fn clone(&self) -> AprV2Header
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for AprV2Header
Source§impl Debug for AprV2Header
impl Debug for AprV2Header
Auto Trait Implementations§
impl Freeze for AprV2Header
impl RefUnwindSafe for AprV2Header
impl Send for AprV2Header
impl Sync for AprV2Header
impl Unpin for AprV2Header
impl UnsafeUnpin for AprV2Header
impl UnwindSafe for AprV2Header
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