pub struct AionParser<'a> { /* private fields */ }Expand description
Zero-copy parser for AION v2 files
Provides efficient, allocation-free access to file sections using direct byte slice references.
§Examples
use aion_context::parser::AionParser;
let data = vec![0u8; 1024]; // Mock file data
let parser = AionParser::new(&data)?;
let header = parser.header();
println!("File ID: {}", header.file_id);Implementations§
Source§impl<'a> AionParser<'a>
impl<'a> AionParser<'a>
Sourcepub const fn header(&self) -> &'a FileHeader
pub const fn header(&self) -> &'a FileHeader
Get reference to the file header.
Zero-copy: the reference was bound to the underlying data
slice by new and cached on the parser, so this accessor is
a simple field read and cannot fail.
Sourcepub fn encrypted_rules_bytes(&self) -> Result<&'a [u8]>
pub fn encrypted_rules_bytes(&self) -> Result<&'a [u8]>
Sourcepub fn version_chain_bytes(&self) -> Result<&'a [u8]>
pub fn version_chain_bytes(&self) -> Result<&'a [u8]>
Sourcepub fn signatures_bytes(&self) -> Result<&'a [u8]>
pub fn signatures_bytes(&self) -> Result<&'a [u8]>
Sourcepub fn audit_trail_bytes(&self) -> Result<&'a [u8]>
pub fn audit_trail_bytes(&self) -> Result<&'a [u8]>
Get audit trail section as byte slice
Note: Audit entries are variable-length, so this returns raw bytes. Use audit module to parse individual entries.
§Errors
Returns error if section bounds are invalid
Sourcepub fn string_table_bytes(&self) -> Result<&'a [u8]>
pub fn string_table_bytes(&self) -> Result<&'a [u8]>
Sourcepub fn integrity_hash(&self) -> Result<&'a [u8; 32]>
pub fn integrity_hash(&self) -> Result<&'a [u8; 32]>
Sourcepub fn verify_integrity(&self) -> Result<()>
pub fn verify_integrity(&self) -> Result<()>
Verify file integrity by computing BLAKE3 hash and comparing
Computes the hash of all bytes except the final 32-byte hash, then compares with the stored hash.
§Errors
Returns AionError::CorruptedFile if the hash doesn’t match,
indicating the file has been corrupted or tampered with.
§Examples
use aion_context::parser::AionParser;
let parser = AionParser::new(&data)?;
parser.verify_integrity()?; // Returns Ok if validSourcepub fn get_version_entry(&self, index: usize) -> Result<VersionEntry>
pub fn get_version_entry(&self, index: usize) -> Result<VersionEntry>
Get a version entry by index
§Errors
Returns error if index is out of bounds or entry cannot be parsed
Sourcepub fn get_signature_entry(&self, index: usize) -> Result<SignatureEntry>
pub fn get_signature_entry(&self, index: usize) -> Result<SignatureEntry>
Get a signature entry by index
§Errors
Returns error if index is out of bounds or entry cannot be parsed
Sourcepub fn get_audit_entry(&self, index: usize) -> Result<AuditEntry>
pub fn get_audit_entry(&self, index: usize) -> Result<AuditEntry>
Get an audit entry by index
§Errors
Returns error if index is out of bounds or entry cannot be parsed
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for AionParser<'a>
impl<'a> RefUnwindSafe for AionParser<'a>
impl<'a> Send for AionParser<'a>
impl<'a> Sync for AionParser<'a>
impl<'a> Unpin for AionParser<'a>
impl<'a> UnsafeUnpin for AionParser<'a>
impl<'a> UnwindSafe for AionParser<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more