pub trait Handler<I>: Clone + Sendwhere
I: TryFromInput,{
type Output: Send;
// Required method
fn handle(&self, input: I) -> impl Future<Output = Self::Output> + Send;
}
Expand description
Allows to handle a specific HandlerInput
.
Required Associated Types§
sourcetype Output: Send
type Output: Send
A future output returned by Self::handle
method.
Use HandlerResult
or any type that can be converted into it
if you want to use the handler in crate::App
.
It is possible to use any other type, e.g. if you want to use it in a decorator.
But finally you need to convert it into HandlerResult
.
Required Methods§
Object Safety§
This trait is not object safe.
Implementors§
source§impl Handler<()> for DirectRateLimitPredicate<Jitter, MethodWait>
Available on crate feature ratelimit
only.
impl Handler<()> for DirectRateLimitPredicate<Jitter, MethodWait>
Available on crate feature
ratelimit
only.type Output = PredicateResult
source§impl Handler<()> for DirectRateLimitPredicate<NoJitter, MethodDiscard>
Available on crate feature ratelimit
only.
impl Handler<()> for DirectRateLimitPredicate<NoJitter, MethodDiscard>
Available on crate feature
ratelimit
only.type Output = PredicateResult
source§impl Handler<()> for DirectRateLimitPredicate<NoJitter, MethodWait>
Available on crate feature ratelimit
only.
impl Handler<()> for DirectRateLimitPredicate<NoJitter, MethodWait>
Available on crate feature
ratelimit
only.type Output = PredicateResult
source§impl Handler<HandlerInput> for Chain
impl Handler<HandlerInput> for Chain
type Output = Result<(), HandlerError>
source§impl<B, H, HI, HR, HS, HE> Handler<HandlerInput> for DialogueDecorator<B, H, HI, HS>where
B: SessionBackend + Send + Sync + 'static,
H: Handler<HI, Output = Result<HR, HE>> + Sync + 'static,
HI: TryFromInput + Sync,
HI::Error: 'static,
HR: Into<DialogueResult<HS>>,
HS: DialogueState + Send + Sync,
HE: Error + Send + 'static,
Available on crate feature dialogue
only.
impl<B, H, HI, HR, HS, HE> Handler<HandlerInput> for DialogueDecorator<B, H, HI, HS>where
B: SessionBackend + Send + Sync + 'static,
H: Handler<HI, Output = Result<HR, HE>> + Sync + 'static,
HI: TryFromInput + Sync,
HI::Error: 'static,
HR: Into<DialogueResult<HS>>,
HS: DialogueState + Send + Sync,
HE: Error + Send + 'static,
Available on crate feature
dialogue
only.type Output = Result<(), HandlerError>
source§impl<B, P, PI, PO, HS> Handler<HandlerInput> for DialoguePredicate<B, P, PI, HS>where
B: SessionBackend + Send + Sync + 'static,
P: Handler<PI, Output = PO> + Sync + 'static,
PI: TryFromInput + Sync,
PI::Error: 'static,
PO: Into<PredicateResult>,
HS: DialogueState + Send + Sync,
Available on crate feature dialogue
only.
impl<B, P, PI, PO, HS> Handler<HandlerInput> for DialoguePredicate<B, P, PI, HS>where
B: SessionBackend + Send + Sync + 'static,
P: Handler<PI, Output = PO> + Sync + 'static,
PI: TryFromInput + Sync,
PI::Error: 'static,
PO: Into<PredicateResult>,
HS: DialogueState + Send + Sync,
Available on crate feature
dialogue
only.type Output = PredicateResult
source§impl<E, H, HI> Handler<HandlerInput> for ErrorDecorator<E, H, HI>where
E: ErrorHandler + Clone + Sync + 'static,
H: Handler<HI> + Sync + 'static,
HI: TryFromInput + Sync,
HI::Error: 'static,
H::Output: IntoHandlerResult,
impl<E, H, HI> Handler<HandlerInput> for ErrorDecorator<E, H, HI>where
E: ErrorHandler + Clone + Sync + 'static,
H: Handler<HI> + Sync + 'static,
HI: TryFromInput + Sync,
HI::Error: 'static,
H::Output: IntoHandlerResult,
type Output = Result<(), HandlerError>
source§impl<K> Handler<K> for KeyedRateLimitPredicate<K, Jitter, MethodWait>
Available on crate feature ratelimit
only.
impl<K> Handler<K> for KeyedRateLimitPredicate<K, Jitter, MethodWait>
Available on crate feature
ratelimit
only.type Output = PredicateResult
source§impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodDiscard>
Available on crate feature ratelimit
only.
impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodDiscard>
Available on crate feature
ratelimit
only.type Output = PredicateResult
source§impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodWait>
Available on crate feature ratelimit
only.
impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodWait>
Available on crate feature
ratelimit
only.type Output = PredicateResult
source§impl<P> Handler<HandlerInput> for AccessPredicate<P>
Available on crate feature access
only.
impl<P> Handler<HandlerInput> for AccessPredicate<P>
Available on crate feature
access
only.