pub struct SymbolMap { /* private fields */ }Expand description
A table backed by a map — the reference implementation, for tests and for a caller whose index is simple enough that it does not need a type of its own.
use cpp_parser::{MacroBody, ParserConfig, SymbolKind, SymbolMap};
let mut symbols = SymbolMap::new();
symbols.insert("MY_API", SymbolKind::Macro { function_like: false, body: MacroBody::Specifier });
symbols.insert("Widget", SymbolKind::Type);
let config = ParserConfig::default().with_symbol_table(&symbols);Implementations§
Source§impl SymbolMap
impl SymbolMap
pub fn new() -> Self
Sourcepub fn insert(&mut self, name: &str, kind: SymbolKind)
pub fn insert(&mut self, name: &str, kind: SymbolKind)
Record what name is, replacing any earlier answer for it.
Sourcepub fn with(self, name: &str, kind: SymbolKind) -> Self
pub fn with(self, name: &str, kind: SymbolKind) -> Self
SymbolMap::insert, for building a table in one expression.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SymbolMap
impl RefUnwindSafe for SymbolMap
impl Send for SymbolMap
impl Sync for SymbolMap
impl Unpin for SymbolMap
impl UnsafeUnpin for SymbolMap
impl UnwindSafe for SymbolMap
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more