pub struct State<'a, Q: QueryContext> {
pub bindings: Vec<Vec<Vec<Box<VariableContent<'a, Q>>>>>,
pub effects: Vec<Effect<'a, Q>>,
pub files: FileRegistry<'a, Q>,
/* private fields */
}
Fields§
§bindings: Vec<Vec<Vec<Box<VariableContent<'a, Q>>>>>
§effects: Vec<Effect<'a, Q>>
§files: FileRegistry<'a, Q>
Implementations§
Source§impl<'a, Q: QueryContext> State<'a, Q>
impl<'a, Q: QueryContext> State<'a, Q>
pub fn new( bindings: Vec<Vec<Vec<Box<VariableContent<'a, Q>>>>>, registry: FileRegistry<'a, Q>, ) -> Self
pub fn get_files<'b>(&'b self) -> &'b FileRegistry<'_, Q>where
'b: 'a,
pub fn get_rng(&mut self) -> &mut StdRng
pub fn register_pattern_definition(&mut self, name: &str) -> usize
pub fn get_name(&self, var: &Variable) -> &str
Sourcepub fn find_var(&self, name: &str) -> Option<Variable>
pub fn find_var(&self, name: &str) -> Option<Variable>
Attempt to find a variable by name in any scope This is inefficient and should only be used when we haven’t pre-allocated a Variable reference
If you have a Variable reference, use trace_var
instead to find the latest binding
Sourcepub fn find_var_in_scope(&mut self, name: &str) -> Option<Variable>
pub fn find_var_in_scope(&mut self, name: &str) -> Option<Variable>
Attempt to find a variable by name in the current scope
Sourcepub fn trace_var(&self, var: &Variable) -> Variable
pub fn trace_var(&self, var: &Variable) -> Variable
Trace a variable to the root binding Where possible, prefer trace_var_mut
pub fn trace_var_mut(&mut self, var: &Variable) -> Variable
pub fn bindings_history_to_ranges( &self, language: &Q::Language<'a>, current_name: Option<&str>, ) -> (Vec<VariableMatch>, Vec<Range>, bool)
Trait Implementations§
Auto Trait Implementations§
impl<'a, Q> Freeze for State<'a, Q>
impl<'a, Q> !RefUnwindSafe for State<'a, Q>
impl<'a, Q> !Send for State<'a, Q>
impl<'a, Q> !Sync for State<'a, Q>
impl<'a, Q> Unpin for State<'a, Q>
impl<'a, Q> !UnwindSafe for State<'a, Q>
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