pub struct FafbHeader {
pub version_major: u8,
pub version_minor: u8,
pub flags: Flags,
pub source_checksum: u32,
pub created_timestamp: u64,
pub section_count: u16,
pub section_table_offset: u32,
pub reserved: u16,
pub total_size: u32,
}Expand description
The 32-byte FAFB file header
Fields§
§version_major: u8Format version - major (breaking changes)
version_minor: u8Format version - minor (additive changes)
flags: FlagsFeature flags
source_checksum: u32CRC32 checksum of original .faf YAML source
created_timestamp: u64Unix timestamp when .fafb was created
section_count: u16Number of sections in the file
section_table_offset: u32Byte offset to section table (from start of file)
reserved: u16Reserved for future use
total_size: u32Total file size in bytes
Implementations§
Source§impl FafbHeader
impl FafbHeader
Sourcepub fn new() -> FafbHeader
pub fn new() -> FafbHeader
Create a new header with default version and empty flags
Sourcepub fn with_timestamp() -> FafbHeader
pub fn with_timestamp() -> FafbHeader
Create header with current timestamp
Sourcepub fn compute_checksum(yaml_source: &[u8]) -> u32
pub fn compute_checksum(yaml_source: &[u8]) -> u32
Compute CRC32 checksum of source YAML
Sourcepub fn set_source_checksum(&mut self, yaml_source: &[u8])
pub fn set_source_checksum(&mut self, yaml_source: &[u8])
Set the source checksum from YAML content
Sourcepub fn write<W>(&self, writer: &mut W) -> Result<(), FafbError>where
W: Write,
pub fn write<W>(&self, writer: &mut W) -> Result<(), FafbError>where
W: Write,
Write header to a byte buffer
Sourcepub fn read<R>(reader: &mut R) -> Result<FafbHeader, FafbError>where
R: Read,
pub fn read<R>(reader: &mut R) -> Result<FafbHeader, FafbError>where
R: Read,
Read header from a byte buffer
Sourcepub fn from_bytes(data: &[u8]) -> Result<FafbHeader, FafbError>
pub fn from_bytes(data: &[u8]) -> Result<FafbHeader, FafbError>
Read header from a byte slice
Sourcepub fn validate(&self, file_data: &[u8]) -> Result<(), FafbError>
pub fn validate(&self, file_data: &[u8]) -> Result<(), FafbError>
Validate header against actual file data
Sourcepub fn is_compatible(&self) -> bool
pub fn is_compatible(&self) -> bool
Check if this header is compatible with the current version
Sourcepub fn version_string(&self) -> String
pub fn version_string(&self) -> String
Get version as string (e.g., “1.0”)
Trait Implementations§
Source§impl Clone for FafbHeader
impl Clone for FafbHeader
Source§fn clone(&self) -> FafbHeader
fn clone(&self) -> FafbHeader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FafbHeader
impl Debug for FafbHeader
Source§impl Default for FafbHeader
impl Default for FafbHeader
Source§fn default() -> FafbHeader
fn default() -> FafbHeader
Returns the “default value” for a type. Read more
Source§impl PartialEq for FafbHeader
impl PartialEq for FafbHeader
impl Eq for FafbHeader
impl StructuralPartialEq for FafbHeader
Auto Trait Implementations§
impl Freeze for FafbHeader
impl RefUnwindSafe for FafbHeader
impl Send for FafbHeader
impl Sync for FafbHeader
impl Unpin for FafbHeader
impl UnsafeUnpin for FafbHeader
impl UnwindSafe for FafbHeader
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.