pub struct SymbolTable { /* private fields */ }
Expand description
The global symbol table. Maps Names
to their definitions.
Names in the symbol table are unique, including between different types of object stored in the symbol table. For example, you cannot have a letting and decision variable with the same name.
Implementations§
Source§impl SymbolTable
impl SymbolTable
Sourcepub fn keys(&self) -> impl Iterator<Item = &Name>
pub fn keys(&self) -> impl Iterator<Item = &Name>
Returns an iterator over the names in the symbol table.
Alias of [names
].
Sourcepub fn names(&self) -> impl Iterator<Item = &Name>
pub fn names(&self) -> impl Iterator<Item = &Name>
Returns an iterator over the names in the symbol table.
Sourcepub fn iter_var(&self) -> impl Iterator<Item = (&Name, &DecisionVariable)>
pub fn iter_var(&self) -> impl Iterator<Item = (&Name, &DecisionVariable)>
Returns an iterator over the names and defintions of all decision variables in the symbol table.
Sourcepub fn get_var(&self, name: &Name) -> Option<&DecisionVariable>
pub fn get_var(&self, name: &Name) -> Option<&DecisionVariable>
Returns a reference to the decision variable with the given name.
Returns None
if:
-
There is no decision variable with that name.
-
The decision variable with that name has been deleted.
-
The object with that name is not a decision variable.
Sourcepub fn get_var_mut(&mut self, name: &Name) -> Option<&mut DecisionVariable>
pub fn get_var_mut(&mut self, name: &Name) -> Option<&mut DecisionVariable>
Returns a mutable reference to the decision variable with the given name.
Returns None
if:
-
There is no decision variable with that name.
-
The decision variable with that name has been deleted.
-
The object with that name is not a decision variable.
Sourcepub fn add_var(&mut self, name: Name, var: DecisionVariable) -> Option<()>
pub fn add_var(&mut self, name: Name, var: DecisionVariable) -> Option<()>
Adds a decision variable to the symbol table as name
.
Returns None
if there is a decision variable or other object with that name in the symbol
table.
Sourcepub fn update_add_var(
&mut self,
name: Name,
var: DecisionVariable,
) -> Option<()>
pub fn update_add_var( &mut self, name: Name, var: DecisionVariable, ) -> Option<()>
Updates a decision variable to the symbol table as name
, or adds it.
Returns None
if name
refers to an object that is not a decision variable.
Sourcepub fn extend(&mut self, other: SymbolTable)
pub fn extend(&mut self, other: SymbolTable)
Extends the symbol table with the given symbol table, updating the gensym counter if necessary.
Sourcepub fn domain_of(&self, name: &Name) -> Option<&Domain>
pub fn domain_of(&self, name: &Name) -> Option<&Domain>
Gets the domain of name
if it exists and has a domain.
Sourcepub fn domain_of_mut(&mut self, name: &Name) -> Option<&mut Domain>
pub fn domain_of_mut(&mut self, name: &Name) -> Option<&mut Domain>
Gets the domain of name
as a mutable reference if it exists and has a domain.
Sourcepub fn type_of(&self, name: &Name) -> Option<ReturnType>
pub fn type_of(&self, name: &Name) -> Option<ReturnType>
Gets the type of name
if it exists and has a type.
Trait Implementations§
Source§impl Clone for SymbolTable
impl Clone for SymbolTable
Source§fn clone(&self) -> SymbolTable
fn clone(&self) -> SymbolTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SymbolTable
impl Debug for SymbolTable
Source§impl Default for SymbolTable
impl Default for SymbolTable
Source§impl<'de> Deserialize<'de> for SymbolTable
impl<'de> Deserialize<'de> for SymbolTable
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for SymbolTable
impl Hash for SymbolTable
Source§impl PartialEq for SymbolTable
impl PartialEq for SymbolTable
Source§impl Serialize for SymbolTable
impl Serialize for SymbolTable
impl Eq for SymbolTable
Auto Trait Implementations§
impl !Freeze for SymbolTable
impl !RefUnwindSafe for SymbolTable
impl Send for SymbolTable
impl !Sync for SymbolTable
impl Unpin for SymbolTable
impl UnwindSafe for SymbolTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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