Trait LookupObject

Source
pub trait LookupObject {
    // Required method
    fn for_each_entry<R>(
        &self,
        ctx: &LookupCtx<'_>,
        f: &mut impl FnMut(&str, LookupResult) -> Option<R>,
    ) -> Option<R>;

    // Provided method
    fn lookup(&self, ctx: &LookupCtx<'_>, name: &str) -> Option<LookupResult> { ... }
}
Expand description

Represent an object which has properties which can be accessible

Required Methods§

Source

fn for_each_entry<R>( &self, ctx: &LookupCtx<'_>, f: &mut impl FnMut(&str, LookupResult) -> Option<R>, ) -> Option<R>

Will call the function for each entry (useful for completion) If the function return Some, it will immediately be returned and not called further

Provided Methods§

Source

fn lookup(&self, ctx: &LookupCtx<'_>, name: &str) -> Option<LookupResult>

Perform a lookup of a given identifier. One does not have to re-implement unless we can make it faster

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.

Implementations on Foreign Types§

Source§

impl LookupObject for Rc<Enumeration>

Source§

fn for_each_entry<R>( &self, _ctx: &LookupCtx<'_>, f: &mut impl FnMut(&str, LookupResult) -> Option<R>, ) -> Option<R>

Source§

impl<T1: LookupObject, T2: LookupObject> LookupObject for (T1, T2)

Source§

fn for_each_entry<R>( &self, ctx: &LookupCtx<'_>, f: &mut impl FnMut(&str, LookupResult) -> Option<R>, ) -> Option<R>

Source§

fn lookup(&self, ctx: &LookupCtx<'_>, name: &str) -> Option<LookupResult>

Implementors§