[][src]Struct symbolic_debuginfo::SymbolMap

pub struct SymbolMap<'data> { /* fields omitted */ }

A sorted list of symbols, suitable for quick lookups.

This type can either be computed from a list or iterator of symbols, or preferrably directly by calling ObjectLike::symbol_map on any object. Symbols in the symbol map are guaranteed to have a size set, except for the last symbol, which is computed by taking the offset to the subsequent symbol.

SymbolMap also exposes a read-only view on the sorted slice of symbols. It can be converted to and from lists of symbols.

Example

let map = SymbolMap::from(vec![
    Symbol { name: Some("A".into()), address: 0x4400, size: 0 },
    Symbol { name: Some("B".into()), address: 0x4200, size: 0 },
    Symbol { name: Some("C".into()), address: 0x4000, size: 0 },
]);

assert_eq!(map[0], Symbol {
    name: Some("C".into()),
    address: 0x4000,
    size: 0x200,
});

Methods

impl<'data> SymbolMap<'data>[src]

pub fn new() -> Self[src]

Creates a new, empty symbol map.

pub fn lookup(&self, address: u64) -> Option<&Symbol<'data>>[src]

Looks up a symbol in the symbol map.

pub fn lookup_range<R>(&self, range: R) -> Option<&Symbol<'data>> where
    R: RangeBounds<u64>, 
[src]

Looks up a symbol covering an entire range.

This is similar to lookup, but it only returns the symbol result if it also covers the inclusive end address of the range.

Trait Implementations

impl<'d> AsRef<[Symbol<'d>]> for SymbolMap<'d>[src]

impl<'data> IntoIterator for SymbolMap<'data>[src]

type Item = Symbol<'data>

The type of the elements being iterated over.

type IntoIter = SymbolMapIter<'data>

Which kind of iterator are we turning this into?

impl<'data, 'a> IntoIterator for &'a SymbolMap<'data>[src]

type Item = &'a Symbol<'data>

The type of the elements being iterated over.

type IntoIter = Iter<'a, Symbol<'data>>

Which kind of iterator are we turning this into?

impl<'data> Default for SymbolMap<'data>[src]

impl<'d> From<Vec<Symbol<'d>>> for SymbolMap<'d>[src]

impl<'data> Clone for SymbolMap<'data>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'data> Debug for SymbolMap<'data>[src]

impl<'d> Deref for SymbolMap<'d>[src]

type Target = [Symbol<'d>]

The resulting type after dereferencing.

impl<'d> FromIterator<Symbol<'d>> for SymbolMap<'d>[src]

Auto Trait Implementations

impl<'data> Send for SymbolMap<'data>

impl<'data> Sync for SymbolMap<'data>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T