pub struct SymbolSet { /* private fields */ }Expand description
A collection of symbols with threshold tracking.
Implementations§
Source§impl SymbolSet
impl SymbolSet
Sourcepub fn with_config(config: ThresholdConfig) -> Self
pub fn with_config(config: ThresholdConfig) -> Self
Creates a new SymbolSet with the specified configuration.
Sourcepub fn with_memory_budget(config: ThresholdConfig, budget_bytes: usize) -> Self
pub fn with_memory_budget(config: ThresholdConfig, budget_bytes: usize) -> Self
Creates a new SymbolSet with a memory budget.
Sourcepub fn insert(&mut self, symbol: Symbol) -> InsertResult
pub fn insert(&mut self, symbol: Symbol) -> InsertResult
Inserts a symbol into the set.
Sourcepub fn insert_batch(
&mut self,
symbols: impl Iterator<Item = Symbol>,
) -> Vec<InsertResult>
pub fn insert_batch( &mut self, symbols: impl Iterator<Item = Symbol>, ) -> Vec<InsertResult>
Inserts multiple symbols into the set.
Sourcepub fn set_block_k(&mut self, sbn: u8, k: u16) -> bool
pub fn set_block_k(&mut self, sbn: u8, k: u16) -> bool
Sets the source-symbol count (K) for a block.
Returns true if the threshold is now reached for that block.
Sourcepub fn symbols_for_block(&self, sbn: u8) -> impl Iterator<Item = &Symbol>
pub fn symbols_for_block(&self, sbn: u8) -> impl Iterator<Item = &Symbol>
Returns an iterator over all symbols for a block.
Sourcepub fn block_progress(&self, sbn: u8) -> Option<&BlockProgress>
pub fn block_progress(&self, sbn: u8) -> Option<&BlockProgress>
Returns block progress for a given block.
Sourcepub fn threshold_reached(&self, sbn: u8) -> bool
pub fn threshold_reached(&self, sbn: u8) -> bool
Returns true if the threshold is reached for a block.
Sourcepub fn ready_blocks(&self) -> Vec<u8> ⓘ
pub fn ready_blocks(&self) -> Vec<u8> ⓘ
Returns all blocks that have reached the threshold.
Sourcepub const fn memory_usage(&self) -> usize
pub const fn memory_usage(&self) -> usize
Returns estimated memory usage in bytes.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&SymbolId, &Symbol)>
pub fn iter(&self) -> impl Iterator<Item = (&SymbolId, &Symbol)>
Iterates over all symbols in the set.
Sourcepub fn drain(&mut self) -> impl Iterator<Item = (SymbolId, Symbol)>
pub fn drain(&mut self) -> impl Iterator<Item = (SymbolId, Symbol)>
Drains all symbols from the set.
Sourcepub fn clear_block(&mut self, sbn: u8)
pub fn clear_block(&mut self, sbn: u8)
Clears symbols for a specific block.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SymbolSet
impl RefUnwindSafe for SymbolSet
impl Send for SymbolSet
impl Sync for SymbolSet
impl Unpin for SymbolSet
impl UnsafeUnpin for SymbolSet
impl UnwindSafe for SymbolSet
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).