pub trait ApiDecorator {
    type Error;
    fn dispatch<F, T>(&self, f: F) -> Result<T, Self::Error>
    where
        F: FnOnce(&dyn Api<Error = Self::Error>) -> Result<T, Self::Error>
; }
Expand description

Trait for decorating an implementation of the API with common pre/post-handling for all request types.

The ApiDecorator and ApiDispatch traits are similar. Only ApiDispatch (defined in mod server) has the req argument to dispatch. That aside, attmpting to combine them into a single trait would result in circular trait implementations impl ApiDispatch for A: Api and impl Api for T: ApiDecorator.

Associated Types

Required methods

Implementors