Trait SharedService

Source
pub trait SharedService {
    type Response: Into<Response>;
    type Error: Into<Box<dyn Error + Send + Sync + 'static>>;
    type Future: Future<Output = Result<Self::Response, Self::Error>> + Send;

    // Required method
    fn call(&self, request: Request) -> Self::Future;
}
Expand description

Shared trait for route handlers. Similar to tower::Service, but takes &self.

Implemented for H where

H: Fn(Request) -> F,
F: Future<Output = Result<S, E>> + Send,
S: Into<Response>,
E: Into<Response>,

Required Associated Types§

Source

type Response: Into<Response>

Source

type Error: Into<Box<dyn Error + Send + Sync + 'static>>

Source

type Future: Future<Output = Result<Self::Response, Self::Error>> + Send

Required Methods§

Source

fn call(&self, request: Request) -> Self::Future

Implementors§

Source§

impl<H, F, S, E> SharedService for H
where F: Future<Output = Result<S, E>> + Send, S: Into<Response>, E: Into<Response>, H: Fn(Request) -> F,

Source§

type Response = Response<Body>

Source§

type Error = Box<dyn Error + Sync + Send>

Source§

type Future = HandlerFuture<F>