pub struct Scope<L: Language> { /* private fields */ }
Expand description
Tracks the variables in scope at this point in parsing.
Implementations§
Source§impl<L: Language> Scope<L>
impl<L: Language> Scope<L>
Sourcepub fn new(
bindings: impl IntoIterator<Item = (String, CoreParameter<L>)>,
) -> Self
pub fn new( bindings: impl IntoIterator<Item = (String, CoreParameter<L>)>, ) -> Self
Creates a new scope with the given set of bindings.
Sourcepub fn lookup(&self, name: &str) -> Option<CoreParameter<L>>
pub fn lookup(&self, name: &str) -> Option<CoreParameter<L>>
Look for a variable with the given name.
Sourcepub fn with_bindings(
&self,
bindings: impl IntoIterator<Item = (String, CoreParameter<L>)>,
) -> Self
pub fn with_bindings( &self, bindings: impl IntoIterator<Item = (String, CoreParameter<L>)>, ) -> Self
Create a new scope that extends self
with bindings
.
Trait Implementations§
Auto Trait Implementations§
impl<L> Freeze for Scope<L>
impl<L> RefUnwindSafe for Scope<L>
impl<L> Send for Scope<L>
impl<L> Sync for Scope<L>
impl<L> Unpin for Scope<L>
impl<L> UnwindSafe for Scope<L>
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