pub struct ReferenceFinder<'a> { /* private fields */ }Expand description
Provides functionality for discovering references (imports, usages, definitions, etc.) of a symbol within a module.
The ReferenceFinder can locate references by walking through the AST
(via a Walker) and collecting relevant Reference items.
Implementations§
Source§impl<'a> ReferenceFinder<'a>
impl<'a> ReferenceFinder<'a>
Sourcepub fn new(interner: &'a ThreadedInterner) -> Self
pub fn new(interner: &'a ThreadedInterner) -> Self
Creates a new ReferenceFinder that uses the given ThreadedInterner
for string lookups and resolutions.
Sourcepub fn find(
&self,
module: &Module,
program: &Program,
query: Query,
) -> Vec<Reference>
pub fn find( &self, module: &Module, program: &Program, query: Query, ) -> Vec<Reference>
Finds all references that match the given Query within the provided Module.
This method:
- Creates a [
Context] that holds the interner, the query, and the current module. - Uses a specialized
Walker(ReferenceFindingWalker) to traverse the AST of the program. - Gathers references (e.g.,
ReferenceKind::Usage,ReferenceKind::Definition) in the context. - Returns all discovered references as a
Vec<Reference>.
A list of Reference objects describing where and how the symbol is referenced
in the code.
Trait Implementations§
Source§impl<'a> Clone for ReferenceFinder<'a>
impl<'a> Clone for ReferenceFinder<'a>
Source§fn clone(&self) -> ReferenceFinder<'a>
fn clone(&self) -> ReferenceFinder<'a>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for ReferenceFinder<'a>
impl<'a> !RefUnwindSafe for ReferenceFinder<'a>
impl<'a> Send for ReferenceFinder<'a>
impl<'a> Sync for ReferenceFinder<'a>
impl<'a> Unpin for ReferenceFinder<'a>
impl<'a> !UnwindSafe for ReferenceFinder<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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