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,

Implementors§

Source§

impl Handler for BytesResource

Source§

impl Handler for EmbeddedResource

Source§

impl Handler for FileResource

Source§

impl Handler for HandlerDynArc

Source§

impl Handler for Routes

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,

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,

Source§

impl<H> Handler for HandlerSimpleAsyncWrapper<H>

Source§

impl<H> Handler for HandlerSimpleSyncWrapper<H>