Skip to main content

HttpOperationAlg

Trait HttpOperationAlg 

Source
pub trait HttpOperationAlg<Handler, Inputs, Kind> {
    type Endpoint;

    // Required method
    fn http_operation(&self, handler: Handler) -> Self::Endpoint;
}
Expand description

Interprets an operation with its declared HTTP input roles and output kind.

A tagless-final specification states this capability for each endpoint it uses. Application, runtime handles, extraction, and conversion are obligations of the interpreter implementation. Built-in and downstream output kinds use exactly the same capability.

A JSON declaration cannot be justified by a text-output capability:

ⓘ
use alux_ext::ext;
use alux_http::{HttpOperationAlg, HttpOperationExt, HttpRouteAlg, RouteAlg, RouteAlgExt, Routes, TextOut};
#[ext(name = MissingJsonExt)]
impl<This> This
where
    This: HttpRouteAlg
        + HttpOperationAlg<(), (), TextOut, Endpoint = <This as RouteAlg>::Endpoint>,
{
    fn api(&self) -> Routes<'_, This> {
        self.routes().get("/", self.op(()).json())
    }
}

Required Associated Types§

Source

type Endpoint

The endpoint representation produced by this interpretation.

Required Methods§

Source

fn http_operation(&self, handler: Handler) -> Self::Endpoint

Interprets the operation under its declared input and output roles.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Compiler, Handler, Inputs, Kind, Handle> HttpOperationAlg<Handler, Inputs, Kind> for Compiler
where Compiler: HandlerAlg + HandlerContextAlg<Handler::Context, Handle = Handle> + HandlerEndpointAlg<Handle, Inputs::Inputs, Inputs::Args, Kind, Handler::Output>, Handler: OperationAlg + ApplyAlg<Handle, Inputs::Args> + Send + Sync + 'static, Inputs: InterpretInputsAlg<Compiler>,

Source§

type Endpoint = <Compiler as HandlerAlg>::Endpoint