Lookup

Trait Lookup 

Source
pub trait Lookup<E: Error = ResolveError> {
    // Required methods
    fn lookup(
        &self,
        name: &QualifiedName,
        target: LookupTarget,
    ) -> Result<Symbol, E>;
    fn ambiguity_error(ambiguous: QualifiedName, others: QualifiedNames) -> E;

    // Provided methods
    fn lookup_within(
        &self,
        name: &QualifiedName,
        within: &Symbol,
        target: LookupTarget,
    ) -> Result<Symbol, E> { ... }
    fn lookup_within_opt(
        &self,
        name: &QualifiedName,
        within: &Option<Symbol>,
        target: LookupTarget,
    ) -> Result<Symbol, E> { ... }
    fn deny_super(&self, name: &QualifiedName) -> ResolveResult<()> { ... }
}
Expand description

Trait to lookup symbols by qualified name.

Required Methods§

Source

fn lookup( &self, name: &QualifiedName, target: LookupTarget, ) -> Result<Symbol, E>

Search a symbol by it’s qualified name.

§Arguments
  • name: Qualified name to search for.
  • target: What to search for
Source

fn ambiguity_error(ambiguous: QualifiedName, others: QualifiedNames) -> E

Return an ambiguity error.

Provided Methods§

Source

fn lookup_within( &self, name: &QualifiedName, within: &Symbol, target: LookupTarget, ) -> Result<Symbol, E>

Search a symbol by it’s qualified name and within the given symbol.

§Arguments
  • name: Qualified name to search for.
  • within: Searches within this symbol too.
  • target: What to search for
§Return

If both are found and one is an alias returns the other one.

Source

fn lookup_within_opt( &self, name: &QualifiedName, within: &Option<Symbol>, target: LookupTarget, ) -> Result<Symbol, E>

Search a symbol by it’s qualified name and within a given symbol

§Arguments
  • name: qualified name to search for
  • within: If some, searches within this symbol too.
  • target: What to search for
§Return

If both are found and one is an alias returns the other one.

Source

fn deny_super(&self, name: &QualifiedName) -> ResolveResult<()>

Returns an error if name starts with super::.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§