Skip to main content

SymbolTable

Trait SymbolTable 

Source
pub trait SymbolTable {
    type SymbolIter: Iterator<Item = LocalSymbol>;

    // Required method
    fn symbols(
        &self,
        source_manager: Arc<dyn SourceManager>,
    ) -> Self::SymbolIter;

    // Provided method
    fn checked_symbols(
        &self,
        source_manager: Arc<dyn SourceManager>,
    ) -> Result<Self::SymbolIter, SymbolResolutionError> { ... }
}
Expand description

This trait abstracts over any type which acts as a symbol table, e.g. a crate::ast::Module.

Resolver construction uses Self::checked_symbols, which must either return the full symbol set or a structured error.

Required Associated Types§

Source

type SymbolIter: Iterator<Item = LocalSymbol>

The concrete iterator type for the container.

Required Methods§

Source

fn symbols(&self, source_manager: Arc<dyn SourceManager>) -> Self::SymbolIter

Get an iterator over the symbols in this symbol table, using the provided SourceManager to emit errors for symbols which are invalid/unresolvable.

Provided Methods§

Source

fn checked_symbols( &self, source_manager: Arc<dyn SourceManager>, ) -> Result<Self::SymbolIter, SymbolResolutionError>

Get an iterator over the symbols in this symbol table, returning a structured error if the full symbol set cannot be represented exactly.

Override this when exact resolver construction needs validation, such as rejecting oversized symbol sets.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§