Trait carapax::Handler

source ·
pub trait Handler<I>: Clone + Send
where 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§

source

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§

source

fn handle(&self, input: I) -> impl Future<Output = Self::Output> + Send

Handles a specific input.

§Arguments
  • input - The input to handle.

See TryFromInput trait implementations for a list of supported types.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Handler<()> for DirectRateLimitPredicate<Jitter, MethodWait>

Available on crate feature ratelimit only.
source§

impl Handler<()> for DirectRateLimitPredicate<NoJitter, MethodDiscard>

Available on crate feature ratelimit only.
source§

impl Handler<()> for DirectRateLimitPredicate<NoJitter, MethodWait>

Available on crate feature ratelimit only.
source§

impl Handler<HandlerInput> for Chain

source§

impl Handler<Command> for CommandPredicate

§

type Output = bool

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.
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.
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,

source§

impl<K> Handler<K> for KeyedRateLimitPredicate<K, Jitter, MethodWait>
where K: Key + Sync + 'static,

Available on crate feature ratelimit only.
source§

impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodDiscard>
where K: Key + Sync,

Available on crate feature ratelimit only.
source§

impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodWait>
where K: Key + Sync + 'static,

Available on crate feature ratelimit only.
source§

impl<P> Handler<HandlerInput> for AccessPredicate<P>
where P: AccessPolicy + Clone + Sync + 'static,

Available on crate feature access only.
source§

impl<P, PI, H, HI> Handler<(PI, HI)> for Predicate<P, PI, H, HI>
where P: Handler<PI> + Sync + 'static, P::Output: Into<PredicateResult>, PI: TryFromInput + Sync + 'static, PI::Error: 'static, H: Handler<HI> + Sync + 'static, H::Output: IntoHandlerResult, HI: TryFromInput + Sync + 'static, HI::Error: 'static,

source§

impl<X, A, B, C, D, E, F, G, H, I, J, R> Handler<(A, B, C, D, E, F, G, H, I, J)> for X
where X: Fn(A, B, C, D, E, F, G, H, I, J) -> R + Clone + Send + Sync, (A, B, C, D, E, F, G, H, I, J): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, B, C, D, E, F, G, H, I, R> Handler<(A, B, C, D, E, F, G, H, I)> for X
where X: Fn(A, B, C, D, E, F, G, H, I) -> R + Clone + Send + Sync, (A, B, C, D, E, F, G, H, I): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, B, C, D, E, F, G, H, R> Handler<(A, B, C, D, E, F, G, H)> for X
where X: Fn(A, B, C, D, E, F, G, H) -> R + Clone + Send + Sync, (A, B, C, D, E, F, G, H): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, B, C, D, E, F, G, R> Handler<(A, B, C, D, E, F, G)> for X
where X: Fn(A, B, C, D, E, F, G) -> R + Clone + Send + Sync, (A, B, C, D, E, F, G): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, B, C, D, E, F, R> Handler<(A, B, C, D, E, F)> for X
where X: Fn(A, B, C, D, E, F) -> R + Clone + Send + Sync, (A, B, C, D, E, F): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, B, C, D, E, R> Handler<(A, B, C, D, E)> for X
where X: Fn(A, B, C, D, E) -> R + Clone + Send + Sync, (A, B, C, D, E): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, B, C, D, R> Handler<(A, B, C, D)> for X
where X: Fn(A, B, C, D) -> R + Clone + Send + Sync, (A, B, C, D): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, B, C, R> Handler<(A, B, C)> for X
where X: Fn(A, B, C) -> R + Clone + Send + Sync, (A, B, C): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, B, R> Handler<(A, B)> for X
where X: Fn(A, B) -> R + Clone + Send + Sync, (A, B): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output

source§

impl<X, A, R> Handler<(A,)> for X
where X: Fn(A) -> R + Clone + Send + Sync, (A,): TryFromInput, R: Future + Send, R::Output: Send,

§

type Output = <R as Future>::Output