Handler::func no longer requires a closure to be sync

This commit is contained in:
StNicolay 2023-06-06 16:48:09 +03:00
parent d62f18980a
commit 10601d49ad
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D

View File

@ -12,8 +12,7 @@ type DynHanlder<T> = Box<
MainDialogue,
T,
) -> crate::PinnedFuture<'static, crate::Result<()>>
+ Send
+ Sync,
+ Send,
>;
pub struct Handler<T> {
@ -31,12 +30,11 @@ impl<T> Handler<T> {
where
H: FnOnce(Throttle<Bot>, Message, DatabaseConnection, MainDialogue, T) -> F
+ Send
+ Sync
+ 'static,
F: Future<Output = crate::Result<()>> + Send + 'static,
{
let handler = Self {
func: Some(Box::new(move |bot, msg, db, dialogue, val| {
func: Some(Box::new(|bot, msg, db, dialogue, val| {
Box::pin(f(bot, msg, db, dialogue, val))
})),
previous: previous.into(),