Skip to main content

HttpEndpoint

Trait HttpEndpoint 

Source
pub trait HttpEndpoint:
    Clone
    + Debug
    + 'static {
    const ROUTES: &'static [EndpointRoute];

    // Required method
    fn dispatch(
        &self,
        context: InvocationContext,
        request: HandleRequest,
    ) -> EndpointFuture;
}
Expand description

A statically routed HTTP Endpoint whose declarations and dispatch share one source.

Prefer crate::http_endpoint! so route identifiers cannot drift between describe and handle. Implement this trait directly only when a provider needs custom dispatch while retaining the generated EndpointProvider behavior.

Required Associated Constants§

Source

const ROUTES: &'static [EndpointRoute]

The complete immutable route table for this provider.

Required Methods§

Source

fn dispatch( &self, context: InvocationContext, request: HandleRequest, ) -> EndpointFuture

Dispatches one request already matched to a route in Self::ROUTES.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§