Trait ContextExt

Source
pub trait ContextExt: Context {
    // Provided method
    fn lookup<T: Object>(&self, id: &ObjectId) -> Result<Arc<T>, LookupError> { ... }
}
Expand description

Extension trait for Context.

This is a separate trait so that Context can be object-safe.

Provided Methods§

Source

fn lookup<T: Object>(&self, id: &ObjectId) -> Result<Arc<T>, LookupError>

Look up an object of a given type, and downcast it.

Return an error if the object can’t be found, or has the wrong type.

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§