pub struct SparseIndex { /* private fields */ }Expand description
Id to arena span, with a record of every id asked for and not found.
Implementations§
Source§impl SparseIndex
impl SparseIndex
Sourcepub fn lookup(&self, id: u32) -> Option<(usize, usize)>
pub fn lookup(&self, id: u32) -> Option<(usize, usize)>
Resolve id to its arena span; an absent id is recorded as a miss.
Sourcepub fn record_miss(&self, id: u32)
pub fn record_miss(&self, id: u32)
Record an id a decoder looked up and did not find (the host fetches it and runs the batch again).
Sourcepub fn peek(&self, id: u32) -> Option<(usize, usize)>
pub fn peek(&self, id: u32) -> Option<(usize, usize)>
Resolve without recording a miss (the reference walk’s own probe).
Sourcepub fn take_misses(&self) -> Vec<u32>
pub fn take_misses(&self) -> Vec<u32>
Drain the ids looked up and not found since the last drain.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Default for SparseIndex
impl Default for SparseIndex
Source§fn default() -> SparseIndex
fn default() -> SparseIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for SparseIndex
impl RefUnwindSafe for SparseIndex
impl Send for SparseIndex
impl Sync for SparseIndex
impl Unpin for SparseIndex
impl UnwindSafe for SparseIndex
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