pub struct SectionTable { /* private fields */ }Expand description
The section table containing all section entries
Implementations§
Source§impl SectionTable
impl SectionTable
Sourcepub fn new() -> SectionTable
pub fn new() -> SectionTable
Create an empty section table
Sourcepub fn with_capacity(capacity: usize) -> SectionTable
pub fn with_capacity(capacity: usize) -> SectionTable
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>(&self, writer: &mut W) -> Result<(), FafbError>where
W: Write,
pub fn write<W>(&self, writer: &mut W) -> Result<(), FafbError>where
W: Write,
Write section table to a byte buffer
Sourcepub fn read<R>(reader: &mut R, count: usize) -> Result<SectionTable, FafbError>where
R: Read,
pub fn read<R>(reader: &mut R, count: usize) -> Result<SectionTable, FafbError>where
R: Read,
Read section table from a byte buffer
Sourcepub fn from_bytes(data: &[u8], count: usize) -> Result<SectionTable, FafbError>
pub fn from_bytes(data: &[u8], count: usize) -> Result<SectionTable, FafbError>
Read section table from a byte slice
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§type Item = &'a SectionEntry
type Item = &'a SectionEntry
The type of the elements being iterated over.
Source§type IntoIter = Iter<'a, SectionEntry>
type IntoIter = Iter<'a, SectionEntry>
Which kind of iterator are we turning this into?
Source§fn into_iter(self) -> <&'a SectionTable as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a SectionTable as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
Source§impl IntoIterator for SectionTable
impl IntoIterator for SectionTable
Source§type Item = SectionEntry
type Item = SectionEntry
The type of the elements being iterated over.
Source§type IntoIter = IntoIter<SectionEntry>
type IntoIter = IntoIter<SectionEntry>
Which kind of iterator are we turning this into?
Source§fn into_iter(self) -> <SectionTable as IntoIterator>::IntoIter
fn into_iter(self) -> <SectionTable as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
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