pub struct Header {Show 19 fields
pub magic: [u8; 4],
pub version: u32,
pub checksum: u32,
pub total_size: u32,
pub str_blob_offset: u32,
pub str_table_offset: u32,
pub node_types_offset: u32,
pub node_fields_offset: u32,
pub trivia_offset: u32,
pub type_meta_offset: u32,
pub entrypoints_offset: u32,
pub transitions_offset: u32,
pub str_table_count: u16,
pub node_types_count: u16,
pub node_fields_count: u16,
pub trivia_count: u16,
pub entrypoints_count: u16,
pub transitions_count: u16,
pub flags: u16,
/* private fields */
}Expand description
File header - first 64 bytes of the bytecode file.
Note: TypeMeta sub-section counts are stored in the TypeMetaHeader, not in the main header. See type_meta.rs for details.
Fields§
§magic: [u8; 4]Magic bytes: b“PTKQ“
version: u32Format version (currently 1)
checksum: u32CRC32 checksum of everything after the header
total_size: u32Total file size in bytes
str_blob_offset: u32§str_table_offset: u32§node_types_offset: u32§node_fields_offset: u32§trivia_offset: u32§type_meta_offset: u32§entrypoints_offset: u32§transitions_offset: u32§str_table_count: u16§node_types_count: u16§node_fields_count: u16§trivia_count: u16§entrypoints_count: u16§transitions_count: u16§flags: u16Header flags (see flags module for bit definitions).
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 is_linked(&self) -> bool
pub fn is_linked(&self) -> bool
Returns true if the bytecode is linked (contains resolved grammar IDs).
Sourcepub fn set_linked(&mut self, linked: bool)
pub fn set_linked(&mut self, linked: bool)
Set the linked flag.
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.