pub trait Service<Req = ()> {
    type Response;
    type Error;

    // Required method
    fn call(
        &self,
        req: Req
    ) -> impl Future<Output = Result<Self::Response, Self::Error>>;
}
Expand description

Trait for simulate Fn<(&Self, Arg)> -> impl Future<Output = Result<T, E>> + '_. The function call come from stateful type that can be referenced within returned opaque future.

Required Associated Types§

source

type Response

The Ok part of output future.

source

type Error

The Err part of output future.

Required Methods§

source

fn call( &self, req: Req ) -> impl Future<Output = Result<Self::Response, Self::Error>>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for Infallible

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, _: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for EncodingError

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, req: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for MultipartError

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for HandshakeError

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for Error

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for Box<dyn Error + Send + Sync>

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for FromUtf8Error

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for Error

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for TooManyRequests

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for Error

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for Error

§

type Response = Response<ResponseBody>

§

type Error = Infallible

source§

async fn call( &self, ctx: WebContext<'r, C, B> ) -> Result<Self::Response, Self::Error>

source§

impl<Arg, R> Service<Arg> for MethodNotAllowedBuilder<R>
where R: Service<Arg>,

§

type Response = MethodNotAllowedService<<R as Service<Arg>>::Response>

§

type Error = <R as Service<Arg>>::Error

source§

async fn call( &self, _: Arg ) -> Result<<MethodNotAllowedBuilder<R> as Service<Arg>>::Response, <MethodNotAllowedBuilder<R> as Service<Arg>>::Error>

source§

impl<CF, Fut, C, CErr, S, E> Service<Result<S, E>> for ContextBuilder<CF>
where CF: Fn() -> Fut, Fut: Future<Output = Result<C, CErr>>, C: 'static, CErr: Debug + 'static, E: Debug + 'static,

§

type Response = ContextService<C, S>

§

type Error = Box<dyn Debug>

source§

async fn call( &self, res: Result<S, E> ) -> Result<<ContextBuilder<CF> as Service<Result<S, E>>>::Response, <ContextBuilder<CF> as Service<Result<S, E>>>::Error>

source§

impl<F, Req, T, O> Service<Req> for HandlerService<F, T, O, ServiceMark>
where T: FromRequest<'static, Req>, F: AsyncClosure<T, Output = O> + for<'a> AsyncClosure<<T as FromRequest<'static, Req>>::Type<'a>>, O: Responder<Req>, <T as FromRequest<'static, Req>>::Error: From<<O as Responder<Req>>::Error>,

§

type Response = <O as Responder<Req>>::Response

§

type Error = <T as FromRequest<'static, Req>>::Error

source§

async fn call( &self, req: Req ) -> Result<<HandlerService<F, T, O, ServiceMark> as Service<Req>>::Response, <HandlerService<F, T, O, ServiceMark> as Service<Req>>::Error>

source§

impl<F, T, O> Service for HandlerService<F, T, O, BuilderMark>
where F: Clone,

§

type Response = HandlerService<F, T, O, ServiceMark>

§

type Error = Infallible

source§

async fn call( &self, _: () ) -> Result<<HandlerService<F, T, O, BuilderMark> as Service>::Response, <HandlerService<F, T, O, BuilderMark> as Service>::Error>

source§

impl<FA, S, E, const HEADER_LIMIT: usize, const READ_BUF_LIMIT: usize, const WRITE_BUF_LIMIT: usize> Service<Result<S, E>> for HttpServiceBuilder<Http, Stream, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
where FA: Service, <FA as Service>::Error: Debug + 'static, E: Debug + 'static,

§

type Response = HttpService<Stream, S, RequestBody, <FA as Service>::Response, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>

§

type Error = Box<dyn Debug>

source§

async fn call( &self, res: Result<S, E> ) -> Result<<HttpServiceBuilder<Http, Stream, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT> as Service<Result<S, E>>>::Response, <HttpServiceBuilder<Http, Stream, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT> as Service<Result<S, E>>>::Error>

source§

impl<I, Req> Service<Req> for Box<I>
where I: ServiceObject<Req> + ?Sized,

§

type Response = <I as ServiceObject<Req>>::Response

§

type Error = <I as ServiceObject<Req>>::Error

source§

async fn call( &self, req: Req ) -> Result<<Box<I> as Service<Req>>::Response, <Box<I> as Service<Req>>::Error>

source§

impl<Obj, Arg> Service<Arg> for Router<Obj>
where Obj: Service<Arg>, Arg: Clone,

§

type Response = RouterService<<Obj as Service<Arg>>::Response>

§

type Error = <Obj as Service<Arg>>::Error

source§

async fn call( &self, arg: Arg ) -> Result<<Router<Obj> as Service<Arg>>::Response, <Router<Obj> as Service<Arg>>::Error>

source§

impl<R, N, Req, E, const M: usize> Service<Req> for RouteService<R, N, M>
where R: Service<Req, Error = E>, N: Service<Req, Response = <R as Service<Req>>::Response, Error = RouterError<E>>, Req: BorrowReq<Method>,

§

type Response = <R as Service<Req>>::Response

§

type Error = RouterError<E>

source§

async fn call( &self, req: Req ) -> Result<<RouteService<R, N, M> as Service<Req>>::Response, <RouteService<R, N, M> as Service<Req>>::Error>

source§

impl<R, Req> Service<Req> for MethodNotAllowedService<R>
where R: Service<Req>,

§

type Response = <R as Service<Req>>::Response

§

type Error = RouterError<<R as Service<Req>>::Error>

source§

async fn call( &self, _: Req ) -> Result<<MethodNotAllowedService<R> as Service<Req>>::Response, <MethodNotAllowedService<R> as Service<Req>>::Error>

source§

impl<S, Arg> Service<Arg> for RouterMapErr<S>
where S: Service<Arg>,

§

type Response = MapErrService<<S as Service<Arg>>::Response>

§

type Error = <S as Service<Arg>>::Error

source§

async fn call( &self, arg: Arg ) -> Result<<RouterMapErr<S> as Service<Arg>>::Response, <RouterMapErr<S> as Service<Arg>>::Error>

source§

impl<S, E> Service<Result<S, E>> for H3ServiceBuilder

§

type Response = H3Service<S>

§

type Error = E

source§

async fn call( &self, res: Result<S, E> ) -> Result<<H3ServiceBuilder as Service<Result<S, E>>>::Response, <H3ServiceBuilder as Service<Result<S, E>>>::Error>

source§

impl<S, E> Service<Result<S, E>> for SocketConfig

§

type Response = SocketConfigService<S>

§

type Error = E

source§

async fn call( &self, res: Result<S, E> ) -> Result<<SocketConfig as Service<Result<S, E>>>::Response, <SocketConfig as Service<Result<S, E>>>::Error>

source§

impl<S, Req> Service<Req> for Arc<S>
where S: Service<Req> + ?Sized,

§

type Response = <S as Service<Req>>::Response

§

type Error = <S as Service<Req>>::Error

source§

async fn call( &self, req: Req ) -> Result<<Arc<S> as Service<Req>>::Response, <Arc<S> as Service<Req>>::Error>

source§

impl<S, Req> Service<Req> for Pin<S>
where S: Deref, <S as Deref>::Target: Service<Req>,

§

type Response = <<S as Deref>::Target as Service<Req>>::Response

§

type Error = <<S as Deref>::Target as Service<Req>>::Error

source§

async fn call( &self, req: Req ) -> Result<<Pin<S> as Service<Req>>::Response, <Pin<S> as Service<Req>>::Error>

source§

impl<S, ResB, BE> Service<(UdpStream, SocketAddr)> for H3Service<S>
where S: Service<Request<RequestExt<RequestBody>>, Response = Response<ResB>>, <S as Service<Request<RequestExt<RequestBody>>>>::Error: Debug, ResB: Stream<Item = Result<Bytes, BE>>, BE: Debug,

§

type Response = ()

§

type Error = HttpServiceError<<S as Service<Request<RequestExt<RequestBody>>>>::Error, BE>

source§

async fn call( &self, __arg1: (UdpStream, SocketAddr) ) -> Result<<H3Service<S> as Service<(UdpStream, SocketAddr)>>::Response, <H3Service<S> as Service<(UdpStream, SocketAddr)>>::Error>

source§

impl<St, FA, S, E, const HEADER_LIMIT: usize, const READ_BUF_LIMIT: usize, const WRITE_BUF_LIMIT: usize> Service<Result<S, E>> for HttpServiceBuilder<Http1, St, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
where FA: Service, <FA as Service>::Error: Debug + 'static, E: Debug + 'static,

§

type Response = HttpService<St, S, RequestBody, <FA as Service>::Response, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>

§

type Error = Box<dyn Debug>

source§

async fn call( &self, res: Result<S, E> ) -> Result<<HttpServiceBuilder<Http1, St, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT> as Service<Result<S, E>>>::Response, <HttpServiceBuilder<Http1, St, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT> as Service<Result<S, E>>>::Error>

source§

impl<St, FA, S, E, const HEADER_LIMIT: usize, const READ_BUF_LIMIT: usize, const WRITE_BUF_LIMIT: usize> Service<Result<S, E>> for HttpServiceBuilder<Http2, St, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
where FA: Service, <FA as Service>::Error: Debug + 'static, E: Debug + 'static,

§

type Response = HttpService<St, S, RequestBody, <FA as Service>::Response, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>

§

type Error = Box<dyn Debug>

source§

async fn call( &self, res: Result<S, E> ) -> Result<<HttpServiceBuilder<Http2, St, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT> as Service<Result<S, E>>>::Response, <HttpServiceBuilder<Http2, St, FA, HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT> as Service<Result<S, E>>>::Error>

source§

impl<T, S, E> Service<Result<S, E>> for Option<T>
where T: Service<Result<S, E>, Error = E>,

§

type Response = Pipeline<S, <T as Service<Result<S, E>>>::Response>

§

type Error = <T as Service<Result<S, E>>>::Error

source§

async fn call( &self, res: Result<S, E> ) -> Result<<Option<T> as Service<Result<S, E>>>::Response, <Option<T> as Service<Result<S, E>>>::Error>

Implementors§

source§

impl Service for ServeDir

§

type Response = ServeDirService

§

type Error = Infallible

source§

impl<'r, C> Service<WebContext<'r, C>> for xitca_web::error::Error<C>

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for ParseError

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for LimitError

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for BadRequest

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for ErrorStatus

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for Internal

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for MatchError

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for MethodNotAllowed

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for StdError

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for BodyOverFlow

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for ExtensionNotFound

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for HeaderNotFound

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for InvalidHeaderValue

source§

impl<'r, C, B> Service<WebContext<'r, C, B>> for ToStrError

source§

impl<'r, C, B, S> Service<WebContext<'r, C, B>> for EraserService<EraseErr, S>
where S: for<'r2> Service<WebContext<'r, C, B>>, S::Error: for<'r2> Service<WebContext<'r2, C>, Response = WebResponse, Error = Infallible> + Error + Send + Sync + 'static,

§

type Response = <S as Service<WebContext<'r, C, B>>>::Response

§

type Error = Error<C>

source§

impl<'r, C, B, S, ResB> Service<WebContext<'r, C, B>> for RateLimitService<S>
where S: for<'r2> Service<WebContext<'r2, C, B>, Response = WebResponse<ResB>, Error = Error<C>>,

§

type Response = Response<ResB>

§

type Error = Error<C>

source§

impl<'r, C, ReqB, S, ResB> Service<WebContext<'r, C, ReqB>> for TowerCompatService<S>
where S: Service<Request<CompatReqBody<RequestExt<ReqB>, C>>, Response = Response<ResB>>, ResB: Body, C: Clone + 'static, ReqB: Default,

source§

impl<'r, F, C, S, B, ResB, Err> Service<WebContext<'r, C, B>> for SyncService<F, S>
where F: Fn(&mut Next<Err>, WebContext<'_, C>) -> Result<Response<()>, Err> + Send + Clone + 'static, C: Clone + Send + 'static, S: for<'r2> Service<WebContext<'r, C, B>, Response = WebResponse<ResB>, Error = Err>, Err: Send + 'static,

§

type Response = Response<ResB>

§

type Error = Err

source§

impl<'r, S, C, B, Res, Err> Service<WebContext<'r, C, B>> for DecompressService<S>
where B: BodyStream + Default, S: for<'rs> Service<WebContext<'rs, C, Coder<B>>, Response = Res, Error = Err>,

§

type Response = Res

§

type Error = Pipeline<EncodingError, Err>

source§

impl<'r, S, C, B, Res, Err> Service<WebContext<'r, C, B>> for LimitService<S>
where B: BodyStream + Default, S: for<'r2> Service<WebContext<'r2, C, LimitBody<B>>, Response = Res, Error = Err>,

§

type Response = Res

§

type Error = Err

source§

impl<'r, S, C, ReqB, ResB, Err> Service<WebContext<'r, C, ReqB>> for EraserService<EraseReqBody, S>
where S: for<'rs> Service<WebContext<'rs, C>, Response = WebResponse<ResB>, Error = Err>, ReqB: BodyStream<Chunk = Bytes> + Default + 'static, ResB: BodyStream<Chunk = Bytes> + 'static,

source§

impl<Arg, R, N, const M: usize> Service<Arg> for Route<R, N, M>
where R: Service<Arg>, N: Service<Arg, Error = <R as Service<Arg>>::Error>, Arg: Clone,

§

type Response = RouteService<<R as Service<Arg>>::Response, <N as Service<Arg>>::Response, M>

§

type Error = <R as Service<Arg>>::Error

source§

impl<F, Req, Fut, Res, Err> Service<Req> for FnService<F>
where F: Fn(Req) -> Fut, Fut: Future<Output = Result<Res, Err>>,

§

type Response = Res

§

type Error = Err

source§

impl<F, S, E> Service<Result<S, E>> for SyncMiddleware<F>
where F: Clone,

§

type Response = SyncService<F, S>

§

type Error = E

source§

impl<F, S, Req> Service<Req> for xitca_web::service::pipeline::PipelineE<F, S>
where F: Service<Req>, S: Service<Req, Response = <F as Service<Req>>::Response, Error = <F as Service<Req>>::Error>,

§

type Response = <F as Service<Req>>::Response

§

type Error = <F as Service<Req>>::Error

source§

impl<F, T, Arg> Service<Arg> for xitca_web::service::pipeline::PipelineT<F, T, BuildEnclosed>
where F: Service<Arg>, T: Service<Result<<F as Service<Arg>>::Response, <F as Service<Arg>>::Error>>,

§

type Response = <T as Service<Result<<F as Service<Arg>>::Response, <F as Service<Arg>>::Error>>>::Response

§

type Error = <T as Service<Result<<F as Service<Arg>>::Response, <F as Service<Arg>>::Error>>>::Error

source§

impl<L, S, E> Service<Result<S, E>> for xitca_web::middleware::tower_http_compat::TowerHttpCompat<L>
where L: Layer<CompatLayer<S>>,

source§

impl<M, S, E> Service<Result<S, E>> for TypeEraser<M>

§

type Response = EraserService<M, S>

§

type Error = E

source§

impl<R, Arg, F> Service<Arg> for App<R, F>
where R: Service<Arg>,

§

type Response = <R as Service<Arg>>::Response

§

type Error = <R as Service<Arg>>::Error

source§

impl<S> Service for xitca_web::service::tower_http_compat::TowerHttpCompat<S>
where S: Clone,

source§

impl<S, E> Service<Result<S, E>> for Compress

source§

impl<S, E> Service<Result<S, E>> for Decompress

source§

impl<S, E> Service<Result<S, E>> for Limit

§

type Response = LimitService<S>

§

type Error = E

source§

impl<S, E> Service<Result<S, E>> for RateLimit

source§

impl<S, E> Service<Result<S, E>> for Logger

§

type Response = LoggerService<S>

§

type Error = E

source§

impl<S, E> Service<Result<S, E>> for Group<S, E>

§

type Response = S

§

type Error = E

source§

impl<S, E> Service<Result<S, E>> for UncheckedReady

§

type Response = UncheckedReadyService<S>

§

type Error = E

source§

impl<S, Req, F, Err> Service<Req> for xitca_web::service::pipeline::PipelineT<S, F, MapErr>
where S: Service<Req>, F: Fn(<S as Service<Req>>::Error) -> Err,

§

type Response = <S as Service<Req>>::Response

§

type Error = Err

source§

impl<S, Req, F, Res> Service<Req> for xitca_web::service::pipeline::PipelineT<S, F, Map>
where S: Service<Req>, F: Fn(<S as Service<Req>>::Response) -> Res,

§

type Response = Res

§

type Error = <S as Service<Req>>::Error

source§

impl<S, Req, ResB> Service<Req> for CompressService<S>
where Req: BorrowReq<HeaderMap>, S: Service<Req, Response = WebResponse<ResB>>, ResB: BodyStream,

§

type Response = Response<Coder<ResB>>

§

type Error = <S as Service<Req>>::Error

source§

impl<S, Req, ResB> Service<Req> for EraserService<EraseResBody, S>
where S: Service<Req, Response = WebResponse<ResB>>, ResB: BodyStream<Chunk = Bytes> + 'static,

source§

impl<S, Req, S1> Service<Req> for xitca_web::service::pipeline::PipelineT<S, S1, AndThen>
where S: Service<Req>, S1: Service<<S as Service<Req>>::Response, Error = <S as Service<Req>>::Error>,

§

type Response = <S1 as Service<<S as Service<Req>>::Response>>::Response

§

type Error = <S as Service<Req>>::Error

source§

impl<S, Req, T, Res, Err> Service<Req> for xitca_web::service::pipeline::PipelineT<S, T, EnclosedFn>
where T: for<'s> AsyncClosure<(&'s S, Req), Output = Result<Res, Err>>,

§

type Response = Res

§

type Error = Err

source§

impl<SF, Arg, SF1> Service<Arg> for xitca_web::service::pipeline::PipelineT<SF, SF1, BuildAndThen>
where SF: Service<Arg>, Arg: Clone, SF1: Service<Arg>, <SF1 as Service<Arg>>::Error: From<<SF as Service<Arg>>::Error>,

§

type Response = Pipeline<<SF as Service<Arg>>::Response, <SF1 as Service<Arg>>::Response, AndThen>

§

type Error = <SF1 as Service<Arg>>::Error

source§

impl<SF, Arg, SF1> Service<Arg> for xitca_web::service::pipeline::PipelineT<SF, SF1, BuildMap>
where SF: Service<Arg>, SF1: Clone,

§

type Response = Pipeline<<SF as Service<Arg>>::Response, SF1, Map>

§

type Error = <SF as Service<Arg>>::Error

source§

impl<SF, Arg, SF1> Service<Arg> for xitca_web::service::pipeline::PipelineT<SF, SF1, BuildMapErr>
where SF: Service<Arg>, SF1: Clone,

§

type Response = Pipeline<<SF as Service<Arg>>::Response, SF1, MapErr>

§

type Error = <SF as Service<Arg>>::Error

source§

impl<SF, Arg, T> Service<Arg> for xitca_web::service::pipeline::PipelineT<SF, T, BuildEnclosedFn>
where SF: Service<Arg>, T: Clone,

§

type Response = Pipeline<<SF as Service<Arg>>::Response, T, EnclosedFn>

§

type Error = <SF as Service<Arg>>::Error

source§

impl<T, S, E> Service<Result<S, E>> for Extension<T>
where T: Clone,

§

type Response = ExtensionService<S, T>

§

type Error = E