pub struct SectionEntry {
pub section_type: SectionType,
pub priority: Priority,
pub offset: u32,
pub length: u32,
pub token_count: u16,
pub flags: u32,
}Expand description
A single section entry in the section table
Fields§
§section_type: SectionTypeSection type identifier
priority: PriorityTruncation priority (0-255, higher = more important)
offset: u32Byte offset to section data (from start of file)
length: u32Section data length in bytes
token_count: u16Pre-computed token count estimate
flags: u32Section-specific flags (4 bytes for alignment)
Implementations§
Source§impl SectionEntry
impl SectionEntry
Sourcepub fn new(section_type: SectionType, offset: u32, length: u32) -> Self
pub fn new(section_type: SectionType, offset: u32, length: u32) -> Self
Create a new section entry with default priority
Sourcepub fn with_priority(self, priority: Priority) -> Self
pub fn with_priority(self, priority: Priority) -> Self
Create with explicit priority
Sourcepub fn with_token_count(self, count: u16) -> Self
pub fn with_token_count(self, count: u16) -> Self
Create with explicit token count
Sourcepub fn with_flags(self, flags: u32) -> Self
pub fn with_flags(self, flags: u32) -> Self
Create with section-specific flags
Sourcepub fn with_classification(self, classification: ChunkClassification) -> Self
pub fn with_classification(self, classification: ChunkClassification) -> Self
Set classification in the low 2 bits of flags (v2)
Sourcepub fn classification(&self) -> ChunkClassification
pub fn classification(&self) -> ChunkClassification
Get the classification from the low 2 bits of flags (v2)
Sourcepub fn section_flags(&self) -> u32
pub fn section_flags(&self) -> u32
Get section-specific flags (bits 2+, excluding classification)
Sourcepub fn to_bytes(&self) -> FafbResult<Vec<u8>>
pub fn to_bytes(&self) -> FafbResult<Vec<u8>>
Write entry to a new Vec<u8>
Sourcepub fn read<R: Read>(reader: &mut R) -> FafbResult<Self>
pub fn read<R: Read>(reader: &mut R) -> FafbResult<Self>
Read entry from a byte buffer
Sourcepub fn from_bytes(data: &[u8]) -> FafbResult<Self>
pub fn from_bytes(data: &[u8]) -> FafbResult<Self>
Read entry from a byte slice
Sourcepub fn validate_bounds(&self, file_size: u32) -> FafbResult<()>
pub fn validate_bounds(&self, file_size: u32) -> FafbResult<()>
Check if this section’s data range is valid within a file
Trait Implementations§
Source§impl Clone for SectionEntry
impl Clone for SectionEntry
Source§fn clone(&self) -> SectionEntry
fn clone(&self) -> SectionEntry
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 SectionEntry
impl Debug for SectionEntry
Source§impl PartialEq for SectionEntry
impl PartialEq for SectionEntry
impl Eq for SectionEntry
impl StructuralPartialEq for SectionEntry
Auto Trait Implementations§
impl Freeze for SectionEntry
impl RefUnwindSafe for SectionEntry
impl Send for SectionEntry
impl Sync for SectionEntry
impl Unpin for SectionEntry
impl UnsafeUnpin for SectionEntry
impl UnwindSafe for SectionEntry
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.