pub struct SymbolTable<T> { /* private fields */ }Expand description
Symbol table used by the code generator. T is the type of data attached to the symbols.
Implementations§
Source§impl<T> SymbolTable<T>
impl<T> SymbolTable<T>
pub fn new() -> Self
Sourcepub fn from_particle(particle_def: &ParticleIndexEntry) -> Self
pub fn from_particle(particle_def: &ParticleIndexEntry) -> Self
Create symbol table from particle definition
Sourcepub fn add_constant_from_substitution(
&mut self,
name: String,
value: &SubstitutionValue,
) -> Result<()>
pub fn add_constant_from_substitution( &mut self, name: String, value: &SubstitutionValue, ) -> Result<()>
Add a new constant entry to the symbol table from a substitution value
pub fn add_constant_f64(&mut self, name: String, value: f64) -> Result<()>
pub fn add_local_symbol(&mut self, name: String, typ: FipsType) -> Result<()>
pub fn add_local_symbol_with_value( &mut self, name: String, typ: FipsType, value: T, ) -> Result<()>
pub fn add_particle_member( &mut self, name: String, member_id: MemberID, ) -> Result<()>
pub fn add_function( &mut self, name: String, function_id: FunctionID, ) -> Result<()>
Sourcepub fn push_table(&mut self, symbols: SymbolTable<T>)
pub fn push_table(&mut self, symbols: SymbolTable<T>)
Add another symbol table to this symbol table
Sourcepub fn pop_table(&mut self) -> Option<SymbolTable<T>>
pub fn pop_table(&mut self) -> Option<SymbolTable<T>>
Pop the last symbol table pushed
Sourcepub fn convert<U>(self) -> SymbolTable<U>
pub fn convert<U>(self) -> SymbolTable<U>
Convert the symbol table to a different type parameter (resets all symbol values)
Sourcepub fn iter_mut(
&mut self,
) -> impl Iterator<Item = (&String, &mut FipsSymbol<T>)>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (&String, &mut FipsSymbol<T>)>
Create an iterator over all symbols
Sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &FipsSymbol<T>)>
pub fn iter(&self) -> impl Iterator<Item = (&String, &FipsSymbol<T>)>
Create an iterator over all symbols
pub fn resolve_symbol(&self, name: &str) -> Option<&FipsSymbol<T>>
Trait Implementations§
Source§impl<T: Clone> Clone for SymbolTable<T>
impl<T: Clone> Clone for SymbolTable<T>
Source§fn clone(&self) -> SymbolTable<T>
fn clone(&self) -> SymbolTable<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for SymbolTable<T>
impl<T> RefUnwindSafe for SymbolTable<T>where
T: RefUnwindSafe,
impl<T> Send for SymbolTable<T>where
T: Send,
impl<T> Sync for SymbolTable<T>where
T: Sync,
impl<T> Unpin for SymbolTable<T>where
T: Unpin,
impl<T> UnwindSafe for SymbolTable<T>where
T: UnwindSafe,
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