pub struct SymbolReference {
pub name: String,
pub kind: SymbolKind,
pub location: SourceLocation,
pub scope_id: ScopeId,
pub is_write: bool,
}Expand description
A reference to a symbol with usage context for LSP analysis.
Tracks symbol usage sites for features like find-all-references, rename refactoring, and unused symbol detection with precise scope and context information.
§Performance Characteristics
- Memory: ~64 bytes per reference
- Collection: O(n) during AST traversal
- Query time: O(log n) with spatial indexing
§LSP Integration
Essential for:
- Find references: Locate all usage sites
- Rename refactoring: Update all references atomically
- Unused detection: Identify unreferenced symbols
- Call hierarchy: Build caller/callee relationships
Fields§
§name: StringSymbol name (without sigil for variables)
kind: SymbolKindSymbol type inferred from usage context
location: SourceLocationSource location of the reference
scope_id: ScopeIdLexical scope where reference occurs
is_write: boolWhether this is a write reference (assignment)
Trait Implementations§
Source§impl Clone for SymbolReference
impl Clone for SymbolReference
Source§fn clone(&self) -> SymbolReference
fn clone(&self) -> SymbolReference
Returns a duplicate 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 Freeze for SymbolReference
impl RefUnwindSafe for SymbolReference
impl Send for SymbolReference
impl Sync for SymbolReference
impl Unpin for SymbolReference
impl UnsafeUnpin for SymbolReference
impl UnwindSafe for SymbolReference
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