pub struct SectionEntry {
pub name_index: u8,
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§
§name_index: u8String-table index of this section’s name
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 flags: bits 0-1 = classification, bits 2+ section-specific
Implementations§
Source§impl SectionEntry
impl SectionEntry
Sourcepub fn new(name_index: u8, offset: u32, length: u32) -> Self
pub fn new(name_index: u8, offset: u32, length: u32) -> Self
Create a new section entry. Callers normally set the real priority via
with_priority (from the canonical chunk table); the default is medium.
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
Sourcepub fn classification(&self) -> ChunkClassification
pub fn classification(&self) -> ChunkClassification
Get the classification from the low 2 bits of flags
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SectionEntry
impl Debug for SectionEntry
impl Eq for SectionEntry
Source§impl PartialEq for SectionEntry
impl PartialEq for SectionEntry
Source§fn eq(&self, other: &SectionEntry) -> bool
fn eq(&self, other: &SectionEntry) -> bool
self and other values to be equal, and is used by ==.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
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
key and return true if they are equal.