Skip to main content

Handler

Trait Handler 

Source
pub trait Handler
where Self: Send + Sync + 'static,
{ 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§

Source

type Future: Future<Output = ServerResult<Response<Self::ResponseBody>>> + Send + 'static

Source

type ResponseBody: BodyTrait<Data = Bytes, Error = Self::ResponseBodyError> + Send + Sync + 'static

Source

type ResponseBodyError: Error + Send + Sync + 'static

Required Methods§

Source

fn handle(&self, _request: Request<Body>) -> Self::Future

Provided Methods§

Source

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.
Source§

impl Handler for EmbeddedResource

Available on crate features hss-handler and hss-resources only.
Source§

impl Handler for FileResource

Available on crate features hss-handler and hss-resources only.
Source§

impl Handler for HandlerDynArc

Available on crate feature hss-handler only.
Source§

impl Handler for Routes

Available on crate feature hss-routes only.
Source§

impl<C, F, RB> Handler for HandlerFnAsync<C, F, RB>
where C: Fn(Request<Body>) -> F + Send + Sync + 'static, F: Future<Output = ServerResult<Response<RB>>> + Send + 'static, RB: BodyTrait<Data = Bytes> + Send + Sync + 'static, RB::Error: Error + Send + Sync + 'static,

Available on crate feature hss-handler only.
Source§

impl<C, RB> Handler for HandlerFnSync<C, RB>
where C: Fn(Request<Body>) -> ServerResult<Response<RB>> + Send + Sync + 'static, RB: BodyTrait<Data = Bytes> + Send + Sync + 'static, RB::Error: Error + Send + Sync + 'static,

Available on crate feature hss-handler only.
Source§

impl<H> Handler for HandlerSimpleAsyncWrapper<H>

Available on crate features hss-handler and hss-extensions only.
Source§

impl<H> Handler for HandlerSimpleSyncWrapper<H>

Available on crate features hss-handler and hss-extensions only.