pub struct FileHeader {Show 15 fields
pub magic: [u8; 4],
pub version: u32,
pub dimension: u32,
pub language_count: u32,
pub unit_count: u64,
pub edge_count: u64,
pub unit_table_offset: u64,
pub edge_table_offset: u64,
pub string_pool_offset: u64,
pub feature_vec_offset: u64,
pub temporal_offset: u64,
pub index_offset: u64,
pub repo_hash: [u8; 32],
pub compiled_at: u64,
pub _reserved: [u8; 8],
}Expand description
Header of an .acb file. Fixed size: 128 bytes.
Layout (all fields little-endian):
- 0x00: magic [u8; 4]
- 0x04: version u32
- 0x08: dimension u32
- 0x0C: language_count u32
- 0x10: unit_count u64
- 0x18: edge_count u64
- 0x20: unit_table_offset u64
- 0x28: edge_table_offset u64
- 0x30: string_pool_offset u64
- 0x38: feature_vec_offset u64
- 0x40: temporal_offset u64
- 0x48: index_offset u64
- 0x50: repo_hash [u8; 32]
- 0x70: compiled_at u64
- 0x78: _reserved [u8; 8]
Fields§
§magic: [u8; 4]Magic bytes: must be [0x41, 0x43, 0x44, 0x42] (“ACDB”).
version: u32Format version (currently 1).
dimension: u32Feature vector dimensionality.
language_count: u32Number of supported languages in this file.
unit_count: u64Total number of code units.
edge_count: u64Total number of edges.
unit_table_offset: u64Byte offset to code unit table.
edge_table_offset: u64Byte offset to edge table.
string_pool_offset: u64Byte offset to string pool.
feature_vec_offset: u64Byte offset to feature vectors.
temporal_offset: u64Byte offset to temporal block.
index_offset: u64Byte offset to index block.
repo_hash: [u8; 32]Repository root path hash (for cache validation).
compiled_at: u64Compilation timestamp (Unix epoch microseconds).
_reserved: [u8; 8]Reserved for future use.
Implementations§
Source§impl FileHeader
impl FileHeader
Sourcepub fn new(dimension: u32) -> Self
pub fn new(dimension: u32) -> Self
Create a new header with sensible defaults and the given dimension.
Sourcepub fn write_to(&self, w: &mut impl Write) -> AcbResult<()>
pub fn write_to(&self, w: &mut impl Write) -> AcbResult<()>
Write the header to a byte writer (little-endian).
Sourcepub fn read_from(r: &mut impl Read) -> AcbResult<Self>
pub fn read_from(r: &mut impl Read) -> AcbResult<Self>
Read a header from a byte reader (little-endian).
§Errors
AcbError::InvalidMagicif magic bytes don’t match.AcbError::UnsupportedVersionif version is not recognized.AcbError::Ioon read failure.
Sourcepub fn from_bytes(data: &[u8; 128]) -> AcbResult<Self>
pub fn from_bytes(data: &[u8; 128]) -> AcbResult<Self>
Deserialize a header from a 128-byte slice.
Trait Implementations§
Source§impl Clone for FileHeader
impl Clone for FileHeader
Source§fn clone(&self) -> FileHeader
fn clone(&self) -> FileHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more