Struct mogram::handler::ChatHandler
source · pub struct ChatHandler<R, S, T>where
R: Into<Action<ChatAction>>,
T: TelegramClient,{
pub f: Box<dyn Fn(ChatEvent<T>, S) -> BoxFuture<'static, Result<R, 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(ChatEvent<T>, S) -> BoxFuture<'static, Result<R, Error>> + Send + Sync>Wraps the async handler function.
state: SState related to this Chat ID
Implementations§
source§impl<R, S, T> ChatHandler<R, S, T>where
R: Into<Action<ChatAction>>,
S: Default,
T: TelegramClient,
impl<R, S, T> ChatHandler<R, S, T>where R: Into<Action<ChatAction>>, S: Default, T: TelegramClient,
Auto Trait Implementations§
impl<R, S, T> !RefUnwindSafe for ChatHandler<R, S, T>
impl<R, S, T> Send for ChatHandler<R, S, T>where S: Send,
impl<R, S, T> Sync for ChatHandler<R, S, T>where S: Sync,
impl<R, S, T> Unpin for ChatHandler<R, S, T>where S: Unpin,
impl<R, S, T> !UnwindSafe for ChatHandler<R, S, T>
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