Trait ApiDecorator

Source
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§

Source

fn dispatch<F, T>(&self, f: F) -> Result<T, Self::Error>
where F: FnOnce(&dyn Api<Error = Self::Error>) -> Result<T, Self::Error>,

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§

Source§

impl<T, E> ApiDecorator for T
where T: AccountsApi<Error = E> + AppApi<Error = E> + ApplicationConfigApi<Error = E> + ApprovalRequestsApi<Error = E> + AuthApi<Error = E> + BuildApi<Error = E> + CertificateApi<Error = E> + DatasetApi<Error = E> + NodeApi<Error = E> + RegistryApi<Error = E> + SystemApi<Error = E> + TaskApi<Error = E> + ToolsApi<Error = E> + UsersApi<Error = E> + WorkflowApi<Error = E> + WorkflowFinalApi<Error = E> + ZoneApi<Error = E>,

Source§

type Error = E