pub trait ApiDecorator {
type Error;
// Required method
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
.
Required Associated Types§
Required Methods§
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.