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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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