#[repr(C, align(64))]pub struct Header {Show 17 fields
pub magic: [u8; 4],
pub version: u32,
pub checksum: u32,
pub total_size: u32,
pub str_blob_size: u32,
pub regex_blob_size: u32,
pub str_table_count: u16,
pub regex_table_count: u16,
pub node_types_count: u16,
pub node_fields_count: u16,
pub trivia_count: u16,
pub type_defs_count: u16,
pub type_members_count: u16,
pub type_names_count: u16,
pub entrypoints_count: u16,
pub transitions_count: u16,
pub _reserved: [u8; 20],
}Expand description
File header - first 64 bytes of the bytecode file.
v3 layout (offsets computed from counts):
- 0-23: identity and sizes (magic, version, checksum, total_size, str_blob_size, regex_blob_size)
- 24-43: counts (10 × u16) — order matches section order
- 44-63: reserved
Fields§
§magic: [u8; 4]Magic bytes: b“PTKQ“
version: u32Format version (currently 3)
checksum: u32CRC32 checksum of everything after the header
total_size: u32Total file size in bytes
str_blob_size: u32Size of the string blob in bytes.
regex_blob_size: u32Size of the regex blob in bytes.
str_table_count: u16§regex_table_count: u16§node_types_count: u16§node_fields_count: u16§trivia_count: u16§type_defs_count: u16§type_members_count: u16§type_names_count: u16§entrypoints_count: u16§transitions_count: u16§_reserved: [u8; 20]Implementations§
Source§impl Header
impl Header
Sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Decode header from 64 bytes.
pub fn validate_magic(&self) -> bool
pub fn validate_version(&self) -> bool
Sourcepub fn compute_offsets(&self) -> SectionOffsets
pub fn compute_offsets(&self) -> SectionOffsets
Compute section offsets from counts and blob sizes.
Section order (all 64-byte aligned): Header → StringBlob → RegexBlob → StringTable → RegexTable → NodeTypes → NodeFields → Trivia → TypeDefs → TypeMembers → TypeNames → Entrypoints → Transitions
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 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.