Struct carapax::dialogue::DialogueDecorator
source · pub struct DialogueDecorator<B, H, HI, HS> { /* private fields */ }
Available on crate feature
dialogue
only.Expand description
A decorator for dialogue handlers.
An inner handler must return a DialogueResult
.
The decorator will automatically load and save the state of the dialogue returned in the result.
Note that you need to register
a crate::session::SessionManager
instance in the crate::Context
.
Otherwise the decorator will return an error indicating that
the session manager is not registered.
Implementations§
Trait Implementations§
source§impl<B, H, HI, HS> Clone for DialogueDecorator<B, H, HI, HS>where
H: Clone,
impl<B, H, HI, HS> Clone for DialogueDecorator<B, H, HI, HS>where
H: Clone,
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,
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,
§type Output = Result<(), HandlerError>
type Output = Result<(), HandlerError>
A future output returned by
Self::handle
method. Read moreAuto Trait Implementations§
impl<B, H, HI, HS> Freeze for DialogueDecorator<B, H, HI, HS>where
H: Freeze,
impl<B, H, HI, HS> RefUnwindSafe for DialogueDecorator<B, H, HI, HS>
impl<B, H, HI, HS> Send for DialogueDecorator<B, H, HI, HS>
impl<B, H, HI, HS> Sync for DialogueDecorator<B, H, HI, HS>
impl<B, H, HI, HS> Unpin for DialogueDecorator<B, H, HI, HS>
impl<B, H, HI, HS> UnwindSafe for DialogueDecorator<B, H, HI, HS>
Blanket Implementations§
source§impl<P, H, HI> AccessExt<P, HI> for Hwhere
H: Handler<HI>,
HI: TryFromInput,
impl<P, H, HI> AccessExt<P, HI> for Hwhere
H: Handler<HI>,
HI: TryFromInput,
source§fn with_access_policy(
self,
policy: P
) -> Predicate<AccessPredicate<P>, HandlerInput, Self, HI>
fn with_access_policy( self, policy: P ) -> Predicate<AccessPredicate<P>, HandlerInput, Self, HI>
Available on crate feature
access
only.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<H, I> CommandExt<I> for Hwhere
H: Handler<I>,
I: TryFromInput,
impl<H, I> CommandExt<I> for Hwhere
H: Handler<I>,
I: TryFromInput,
source§fn with_command<S: Into<String>>(
self,
name: S
) -> Predicate<CommandPredicate, Command, Self, I>
fn with_command<S: Into<String>>( self, name: S ) -> Predicate<CommandPredicate, Command, Self, I>
Shortcut to create a command handler. Read more
source§impl<P, PI, H, HI, HS> DialogueExt<P, PI, HI, HS> for H
impl<P, PI, H, HI, HS> DialogueExt<P, PI, HI, HS> for H
source§fn with_dialogue<B>(
self,
predicate: P
) -> Predicate<DialoguePredicate<B, P, PI, HS>, HandlerInput, DialogueDecorator<B, Self, HI, HS>, HandlerInput>
fn with_dialogue<B>( self, predicate: P ) -> Predicate<DialoguePredicate<B, P, PI, HS>, HandlerInput, DialogueDecorator<B, Self, HI, HS>, HandlerInput>
Available on crate feature
dialogue
only.source§impl<E, H, HI> ErrorExt<E, HI> for Hwhere
H: Handler<HI>,
HI: TryFromInput,
impl<E, H, HI> ErrorExt<E, HI> for Hwhere
H: Handler<HI>,
HI: TryFromInput,
source§fn on_error(self, error_handler: E) -> ErrorDecorator<E, Self, HI>
fn on_error(self, error_handler: E) -> ErrorDecorator<E, Self, HI>
A shortcut to create a new error decorator. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more