Trait ExtensionAware

Source
pub trait ExtensionAware {
    // Required methods
    fn extensions(&self) -> &ExtensionContainer;
    fn extensions_mut(&mut self) -> &mut ExtensionContainer;

    // Provided methods
    fn extension<E>(&self) -> Result<&E, PayloadError<ProjectError>>
       where E: Extension { ... }
    fn extension_mut<E>(&mut self) -> Result<&mut E, PayloadError<ProjectError>>
       where E: Extension { ... }
}
Expand description

A type that contains extensions

Required Methods§

Source

fn extensions(&self) -> &ExtensionContainer

Gets the extension container

Source

fn extensions_mut(&mut self) -> &mut ExtensionContainer

Gets a mutable reference to the extension container

Provided Methods§

Source

fn extension<E>(&self) -> Result<&E, PayloadError<ProjectError>>
where E: Extension,

If a single extension is registered with a given type, a reference to that value is returned as Some(_)

Source

fn extension_mut<E>(&mut self) -> Result<&mut E, PayloadError<ProjectError>>
where E: Extension,

If a single extension is registered with a given type, a mutable reference to that value is returned as Some(_)

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§