pub struct DeclIndex { /* private fields */ }Expand description
An index of declaration names for fast lookup.
Implementations§
Source§impl DeclIndex
impl DeclIndex
Sourcepub fn add(&mut self, name: &str, offset: u32)
pub fn add(&mut self, name: &str, offset: u32)
Add a name with its byte offset in the binary file.
Sourcepub fn find_offset(&self, name: &str) -> Option<u32>
pub fn find_offset(&self, name: &str) -> Option<u32>
Look up the offset for a name.
Sourcepub fn sorted_names(&self) -> Vec<&str>
pub fn sorted_names(&self) -> Vec<&str>
Return names in sorted order for binary search.
Sourcepub fn binary_search(&self, name: &str) -> Option<u32>
pub fn binary_search(&self, name: &str) -> Option<u32>
Binary search for a name (requires sorted order).
Sourcepub fn write(&self, w: &mut OleanWriter)
pub fn write(&self, w: &mut OleanWriter)
Serialize the index.
Sourcepub fn read(r: &mut OleanReader<'_>) -> Result<Self, OleanError>
pub fn read(r: &mut OleanReader<'_>) -> Result<Self, OleanError>
Deserialize the index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeclIndex
impl RefUnwindSafe for DeclIndex
impl Send for DeclIndex
impl Sync for DeclIndex
impl Unpin for DeclIndex
impl UnsafeUnpin for DeclIndex
impl UnwindSafe for DeclIndex
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