pub struct SourceIndex {
pub definitions: DefinitionIndex,
pub references: ReferenceIndex,
pub symbols: Vec<DocumentSymbol>,
pub regions: Vec<SourceRegion>,
}Expand description
A combined source index with definitions, references, and symbols.
Fields§
§definitions: DefinitionIndexDefinition index.
references: ReferenceIndexReference index.
symbols: Vec<DocumentSymbol>Document symbols.
regions: Vec<SourceRegion>Source regions.
Implementations§
Source§impl SourceIndex
impl SourceIndex
Sourcepub fn register_definition(&mut self, name: impl Into<String>, span: Span)
pub fn register_definition(&mut self, name: impl Into<String>, span: Span)
Register a definition.
Sourcepub fn record_reference(&mut self, name: impl Into<String>, span: Span)
pub fn record_reference(&mut self, name: impl Into<String>, span: Span)
Record a reference.
Sourcepub fn add_symbol(&mut self, symbol: DocumentSymbol)
pub fn add_symbol(&mut self, symbol: DocumentSymbol)
Add a document symbol.
Sourcepub fn add_region(&mut self, region: SourceRegion)
pub fn add_region(&mut self, region: SourceRegion)
Add a source region.
Sourcepub fn symbol_at_offset(&self, offset: usize) -> Option<&DocumentSymbol>
pub fn symbol_at_offset(&self, offset: usize) -> Option<&DocumentSymbol>
Find the symbol at a given byte offset.
Sourcepub fn definition_spans(&self, name: &str) -> &[Span]
pub fn definition_spans(&self, name: &str) -> &[Span]
Get all definition spans for a name.
Sourcepub fn reference_spans(&self, name: &str) -> &[Span]
pub fn reference_spans(&self, name: &str) -> &[Span]
Get all use-site spans for a name.
Sourcepub fn top_level_symbols(&self) -> &[DocumentSymbol]
pub fn top_level_symbols(&self) -> &[DocumentSymbol]
Symbols that are top-level definitions (not inside a namespace).
Trait Implementations§
Source§impl Clone for SourceIndex
impl Clone for SourceIndex
Source§fn clone(&self) -> SourceIndex
fn clone(&self) -> SourceIndex
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 moreSource§impl Debug for SourceIndex
impl Debug for SourceIndex
Source§impl Default for SourceIndex
impl Default for SourceIndex
Source§fn default() -> SourceIndex
fn default() -> SourceIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SourceIndex
impl RefUnwindSafe for SourceIndex
impl Send for SourceIndex
impl Sync for SourceIndex
impl Unpin for SourceIndex
impl UnsafeUnpin for SourceIndex
impl UnwindSafe for SourceIndex
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