pub trait Handler{
type Future: Future<Output = ServerResult<Response<Self::ResponseBody>>> + Send + 'static;
type ResponseBody: BodyTrait<Data = Bytes, Error = Self::ResponseBodyError> + Send + Sync + 'static;
type ResponseBodyError: Error + Send + Sync + 'static;
// Required method
fn handle(&self, _request: Request<Body>) -> Self::Future;
// Provided method
fn wrap(self) -> HandlerWrapper<Self>
where Self: Sized { ... }
}Required Associated Types§
type Future: Future<Output = ServerResult<Response<Self::ResponseBody>>> + Send + 'static
type ResponseBody: BodyTrait<Data = Bytes, Error = Self::ResponseBodyError> + Send + Sync + 'static
type ResponseBodyError: Error + Send + Sync + 'static
Required Methods§
Provided Methods§
fn wrap(self) -> HandlerWrapper<Self>where
Self: Sized,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl Handler for BytesResource
Available on crate features hss-handler and hss-resources only.
impl Handler for BytesResource
Available on crate features
hss-handler and hss-resources only.type Future = Ready<Result<Response<<BytesResource as Handler>::ResponseBody>, Error>>
type ResponseBody = BodyWrapper<Body>
type ResponseBodyError = Error
Source§impl Handler for EmbeddedResource
Available on crate features hss-handler and hss-resources only.
impl Handler for EmbeddedResource
Available on crate features
hss-handler and hss-resources only.type Future = Ready<Result<Response<<EmbeddedResource as Handler>::ResponseBody>, Error>>
type ResponseBody = BodyWrapper<Body>
type ResponseBodyError = Error
Source§impl Handler for FileResource
Available on crate features hss-handler and hss-resources only.
impl Handler for FileResource
Available on crate features
hss-handler and hss-resources only.type Future = Ready<Result<Response<<FileResource as Handler>::ResponseBody>, Error>>
type ResponseBody = BodyWrapper<Body>
type ResponseBodyError = Error
Source§impl Handler for HandlerDynArc
Available on crate feature hss-handler only.
impl Handler for HandlerDynArc
Available on crate feature
hss-handler only.type Future = HandlerFutureDynBox
type ResponseBody = BodyDynBox
type ResponseBodyError = Error
Source§impl Handler for Routes
Available on crate feature hss-routes only.
impl Handler for Routes
Available on crate feature
hss-routes only.type Future = HandlerFutureDynBox
type ResponseBody = BodyDynBox
type ResponseBodyError = Error
Source§impl<C, F, RB> Handler for HandlerFnAsync<C, F, RB>
Available on crate feature hss-handler only.
impl<C, F, RB> Handler for HandlerFnAsync<C, F, RB>
Available on crate feature
hss-handler only.Source§impl<C, RB> Handler for HandlerFnSync<C, RB>
Available on crate feature hss-handler only.
impl<C, RB> Handler for HandlerFnSync<C, RB>
Available on crate feature
hss-handler only.Source§impl<H> Handler for HandlerSimpleAsyncWrapper<H>
Available on crate features hss-handler and hss-extensions only.
impl<H> Handler for HandlerSimpleAsyncWrapper<H>
Available on crate features
hss-handler and hss-extensions only.type Future = HandlerSimpleAsyncWrapperFuture<<H as HandlerSimpleAsync>::Future>
type ResponseBody = BodyWrapper<Body>
type ResponseBodyError = Error
Source§impl<H> Handler for HandlerSimpleSyncWrapper<H>where
H: HandlerSimpleSync,
Available on crate features hss-handler and hss-extensions only.
impl<H> Handler for HandlerSimpleSyncWrapper<H>where
H: HandlerSimpleSync,
Available on crate features
hss-handler and hss-extensions only.