pub struct SymbolTable { /* private fields */ }Expand description
The scope tree of a program, the symbols each scope declares, every use of those symbols, and the files they live in.
Implementations§
Source§impl SymbolTable
impl SymbolTable
pub fn file_path(&self, file: FileId) -> &str
pub fn file_root(&self, file: FileId) -> ScopeId
pub fn files(&self) -> impl Iterator<Item = (FileId, &str)>
pub fn scope_file(&self, scope: ScopeId) -> FileId
Sourcepub fn scope_kind(&self, scope: ScopeId) -> ScopeKind
pub fn scope_kind(&self, scope: ScopeId) -> ScopeKind
The kind of a scope.
Sourcepub fn symbols_in(&self, scope: ScopeId) -> impl Iterator<Item = &Symbol>
pub fn symbols_in(&self, scope: ScopeId) -> impl Iterator<Item = &Symbol>
The symbols reachable by bare name directly in scope.
Sourcepub fn members_of(&self, owner: SymbolId) -> impl Iterator<Item = &Symbol>
pub fn members_of(&self, owner: SymbolId) -> impl Iterator<Item = &Symbol>
The members (fields, enum cases) of a type or enum symbol — the
candidates for completion after owner..
Sourcepub fn member_id(&self, owner: SymbolId, name: &str) -> Option<SymbolId>
pub fn member_id(&self, owner: SymbolId, name: &str) -> Option<SymbolId>
The member of owner named name, if any — resolves owner.name.
Sourcepub fn exported_id(&self, scope: ScopeId, name: &str) -> Option<SymbolId>
pub fn exported_id(&self, scope: ScopeId, name: &str) -> Option<SymbolId>
An exported symbol named name declared directly in scope — how a
member access resolves against an imported library’s global scope.
Sourcepub fn declaration_location(&self, id: SymbolId) -> Option<(FileId, u32, u32)>
pub fn declaration_location(&self, id: SymbolId) -> Option<(FileId, u32, u32)>
A symbol’s declaration location as (file, line, column) — go-to-def,
including into an imported library file.
Sourcepub fn resolve(&self, scope: ScopeId, name: &str) -> Option<&Symbol>
pub fn resolve(&self, scope: ScopeId, name: &str) -> Option<&Symbol>
Resolve name from scope outward, innermost first.
Sourcepub fn resolve_id(&self, scope: ScopeId, name: &str) -> Option<SymbolId>
pub fn resolve_id(&self, scope: ScopeId, name: &str) -> Option<SymbolId>
Like resolve but returns the symbol’s id, so a use can
be recorded against it.
pub fn references( &self, symbol: SymbolId, ) -> impl Iterator<Item = (FileId, u32, u32)> + '_
pub fn occurrences_in_file( &self, file: FileId, ) -> impl Iterator<Item = (u32, u32, SymbolId)> + '_
Trait Implementations§
Source§impl Clone for SymbolTable
impl Clone for SymbolTable
Source§fn clone(&self) -> SymbolTable
fn clone(&self) -> SymbolTable
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SymbolTable
impl RefUnwindSafe for SymbolTable
impl Send for SymbolTable
impl Sync for SymbolTable
impl Unpin for SymbolTable
impl UnsafeUnpin for SymbolTable
impl UnwindSafe for SymbolTable
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