pub struct SectionTable { /* private fields */ }Expand description
The section table containing all section entries
Implementations§
Source§impl SectionTable
impl SectionTable
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with pre-allocated capacity
Sourcepub fn push(&mut self, entry: SectionEntry)
pub fn push(&mut self, entry: SectionEntry)
Add a section entry
Sourcepub fn get(&self, index: usize) -> Option<&SectionEntry>
pub fn get(&self, index: usize) -> Option<&SectionEntry>
Get entry by index
Sourcepub fn get_by_type(&self, section_type: SectionType) -> Option<&SectionEntry>
pub fn get_by_type(&self, section_type: SectionType) -> Option<&SectionEntry>
Get entry by section type
Sourcepub fn entries(&self) -> &[SectionEntry]
pub fn entries(&self) -> &[SectionEntry]
Get all entries
Sourcepub fn entries_by_priority(&self) -> Vec<&SectionEntry>
pub fn entries_by_priority(&self) -> Vec<&SectionEntry>
Get entries sorted by priority (highest first)
Sourcepub fn entries_within_budget(&self, budget: u16) -> Vec<&SectionEntry>
pub fn entries_within_budget(&self, budget: u16) -> Vec<&SectionEntry>
Get entries that fit within a token budget
Sourcepub fn total_tokens(&self) -> u32
pub fn total_tokens(&self) -> u32
Calculate total token count
Sourcepub fn table_size(&self) -> usize
pub fn table_size(&self) -> usize
Calculate total size in bytes (for section table only)
Sourcepub fn write<W: Write>(&self, writer: &mut W) -> FafbResult<()>
pub fn write<W: Write>(&self, writer: &mut W) -> FafbResult<()>
Write section table to a byte buffer
Sourcepub fn to_bytes(&self) -> FafbResult<Vec<u8>>
pub fn to_bytes(&self) -> FafbResult<Vec<u8>>
Write section table to a new Vec<u8>
Sourcepub fn read<R: Read>(reader: &mut R, count: usize) -> FafbResult<Self>
pub fn read<R: Read>(reader: &mut R, count: usize) -> FafbResult<Self>
Read section table from a byte buffer
Sourcepub fn from_bytes(data: &[u8], count: usize) -> FafbResult<Self>
pub fn from_bytes(data: &[u8], count: usize) -> FafbResult<Self>
Read section table from a byte slice
Sourcepub fn validate_bounds(&self, file_size: u32) -> FafbResult<()>
pub fn validate_bounds(&self, file_size: u32) -> FafbResult<()>
Validate all entries against file size
Trait Implementations§
Source§impl Clone for SectionTable
impl Clone for SectionTable
Source§fn clone(&self) -> SectionTable
fn clone(&self) -> SectionTable
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 SectionTable
impl Debug for SectionTable
Source§impl Default for SectionTable
impl Default for SectionTable
Source§fn default() -> SectionTable
fn default() -> SectionTable
Returns the “default value” for a type. Read more
Source§impl<'a> IntoIterator for &'a SectionTable
impl<'a> IntoIterator for &'a SectionTable
Source§impl IntoIterator for SectionTable
impl IntoIterator for SectionTable
Auto Trait Implementations§
impl Freeze for SectionTable
impl RefUnwindSafe for SectionTable
impl Send for SectionTable
impl Sync for SectionTable
impl Unpin for SectionTable
impl UnsafeUnpin for SectionTable
impl UnwindSafe for SectionTable
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