Trait HttpService

Source
pub trait HttpService<B>: Sync
where B: Send,
{ type ResponseBody; // Required method fn call( &self, request: Request<B>, ) -> impl Future<Output = Response<Self::ResponseBody>> + Send; }

Required Associated Types§

Required Methods§

Source

fn call( &self, request: Request<B>, ) -> impl Future<Output = Response<Self::ResponseBody>> + Send

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.

Implementations on Foreign Types§

Source§

impl<B, S> HttpService<B> for &S
where B: Send, S: HttpService<B>,

Source§

type ResponseBody = <S as HttpService<B>>::ResponseBody

Source§

fn call( &self, request: Request<B>, ) -> impl Future<Output = Response<<&S as HttpService<B>>::ResponseBody>> + Send

Source§

impl<B, S> HttpService<B> for Box<S>
where B: Send, S: HttpService<B>,

Source§

type ResponseBody = <S as HttpService<B>>::ResponseBody

Source§

fn call( &self, request: Request<B>, ) -> impl Future<Output = Response<<Box<S> as HttpService<B>>::ResponseBody>> + Send

Source§

impl<B, S> HttpService<B> for Arc<S>
where B: Send, S: HttpService<B> + Send,

Source§

type ResponseBody = <S as HttpService<B>>::ResponseBody

Source§

fn call( &self, request: Request<B>, ) -> impl Future<Output = Response<<Arc<S> as HttpService<B>>::ResponseBody>> + Send

Source§

impl<S, F, Fut, B, B2> HttpService<B> for MapRequestService<S, F>
where S: HttpService<B2>, F: Fn(Request<B>) -> Fut + Sync, Fut: Future<Output = Request<B2>> + Send, B: Send, B2: Send,

Source§

type ResponseBody = <S as HttpService<B2>>::ResponseBody

Source§

async fn call( &self, request: Request<B>, ) -> Response<<MapRequestService<S, F> as HttpService<B>>::ResponseBody>

Source§

impl<S, F, Fut, B, ResB> HttpService<B> for MapResponseService<S, F>
where S: HttpService<B>, F: Fn(Response<<S as HttpService<B>>::ResponseBody>) -> Fut + Sync, Fut: Future<Output = Response<ResB>> + Send, B: Send,

Source§

type ResponseBody = ResB

Source§

async fn call( &self, request: Request<B>, ) -> Response<<MapResponseService<S, F> as HttpService<B>>::ResponseBody>

Source§

impl<S, ReqBody> HttpService<ReqBody> for SetStatusService<S>
where S: HttpService<ReqBody>, ReqBody: Send,

Source§

type ResponseBody = <S as HttpService<ReqBody>>::ResponseBody

Source§

async fn call( &self, req: Request<ReqBody>, ) -> Response<<SetStatusService<S> as HttpService<ReqBody>>::ResponseBody>

Implementors§

Source§

impl<B> HttpService<B> for BoxedHttpService<B>
where B: Send,

Source§

impl<B> HttpService<B> for MethodRouter<B>
where B: Send + 'static,

Source§

impl<B> HttpService<B> for Router<B>
where B: Send + 'static,

Source§

impl<B, S1, S2> HttpService<B> for Either<S1, S2>
where B: Send, S1: HttpService<B>, S2: HttpService<B, ResponseBody = <S1 as HttpService<B>>::ResponseBody>,

Source§

impl<F, X, B> HttpService<B> for FnService<F, X, B>
where B: Send, F: ServiceFn<X, B> + Sync,

Source§

impl<ReqBody> HttpService<ReqBody> for ServeFile
where ReqBody: Send + 'static,

Source§

impl<ReqBody, F, FResBody> HttpService<ReqBody> for ServeDir<F>
where ReqBody: Send, F: HttpService<ReqBody, ResponseBody = FResBody> + Send, FResBody: Body<Data = Bytes> + Send + 'static, <FResBody as Body>::Error: Into<Box<dyn Error + Send + Sync>>,

Source§

impl<S, F, Fut, B, B2> HttpService<B> for zon::middleware::MapRequestService<S, F>
where S: HttpService<B2>, F: Fn(Request<B>) -> Fut + Sync, Fut: Future<Output = Request<B2>> + Send, B: Send, B2: Send,

Source§

impl<S, F, Fut, B, ResB> HttpService<B> for zon::middleware::MapResponseService<S, F>
where S: HttpService<B>, F: Fn(Response<<S as HttpService<B>>::ResponseBody>) -> Fut + Sync, Fut: Future<Output = Response<ResB>> + Send, B: Send,

Source§

impl<S, ReqBody> HttpService<ReqBody> for zon::middleware::SetStatusService<S>
where S: HttpService<ReqBody>, ReqBody: Send,

Source§

impl<S, T, B> HttpService<B> for SetTaskLocalService<S, T>
where S: HttpService<B>, T: Clone + Send + Sync + 'static, B: Send,