pub struct VarScope { /* private fields */ }Expand description
Mapping of variable names to indices inside a scope (e.g. a rule or a query).
Implementations§
Source§impl VarScope
impl VarScope
pub fn new() -> Self
Sourcepub fn get(&self, name: &str) -> Option<Var>
pub fn get(&self, name: &str) -> Option<Var>
Return the variable with the given name, if one exists.
Sourcepub fn get_or_insert(&mut self, name: &str) -> Var
pub fn get_or_insert(&mut self, name: &str) -> Var
Get the index associated with a name, or insert a new association.
Sourcepub fn insert_wildcard(&mut self) -> Var
pub fn insert_wildcard(&mut self) -> Var
Insert a new unnamed wildcard variable.
Sourcepub fn get_name(&self, var: Var) -> Option<&str>
pub fn get_name(&self, var: Var) -> Option<&str>
Return the associated name of the given variable.
Sourcepub fn iter_names(&self) -> impl Iterator<Item = &str>
pub fn iter_names(&self) -> impl Iterator<Item = &str>
Returns the names of variables
Trait Implementations§
impl Eq for VarScope
impl StructuralPartialEq for VarScope
Auto Trait Implementations§
impl Freeze for VarScope
impl RefUnwindSafe for VarScope
impl Send for VarScope
impl Sync for VarScope
impl Unpin for VarScope
impl UnwindSafe for VarScope
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