pub struct Handler<S> {
pub f: Box<dyn Fn(Event, S) -> BoxFuture<'static, Result<Action, Error>> + Send + Sync>,
pub state: S,
}Expand description
A handler for a specific chat ID. This is a wrapper around an async function
that takes a ChatEvent and returns a ChatAction.
Fields§
§f: Box<dyn Fn(Event, S) -> BoxFuture<'static, Result<Action, Error>> + Send + Sync>Wraps the async handler function.
state: SState related to this Chat ID
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<S> !RefUnwindSafe for Handler<S>
impl<S> Send for Handler<S>where S: Send,
impl<S> Sync for Handler<S>where S: Sync,
impl<S> Unpin for Handler<S>where S: Unpin,
impl<S> !UnwindSafe for Handler<S>
Blanket Implementations§
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