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§
Sourcetype SymbolIter: Iterator<Item = LocalSymbol>
type SymbolIter: Iterator<Item = LocalSymbol>
The concrete iterator type for the container.
Required Methods§
Sourcefn symbols(&self, source_manager: Arc<dyn SourceManager>) -> Self::SymbolIter
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§
Sourcefn checked_symbols(
&self,
source_manager: Arc<dyn SourceManager>,
) -> Result<Self::SymbolIter, SymbolResolutionError>
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".