Handler::func no longer requires a closure to be sync
This commit is contained in:
parent
d62f18980a
commit
10601d49ad
@ -12,8 +12,7 @@ type DynHanlder<T> = Box<
|
|||||||
MainDialogue,
|
MainDialogue,
|
||||||
T,
|
T,
|
||||||
) -> crate::PinnedFuture<'static, crate::Result<()>>
|
) -> crate::PinnedFuture<'static, crate::Result<()>>
|
||||||
+ Send
|
+ Send,
|
||||||
+ Sync,
|
|
||||||
>;
|
>;
|
||||||
|
|
||||||
pub struct Handler<T> {
|
pub struct Handler<T> {
|
||||||
@ -31,12 +30,11 @@ impl<T> Handler<T> {
|
|||||||
where
|
where
|
||||||
H: FnOnce(Throttle<Bot>, Message, DatabaseConnection, MainDialogue, T) -> F
|
H: FnOnce(Throttle<Bot>, Message, DatabaseConnection, MainDialogue, T) -> F
|
||||||
+ Send
|
+ Send
|
||||||
+ Sync
|
|
||||||
+ 'static,
|
+ 'static,
|
||||||
F: Future<Output = crate::Result<()>> + Send + 'static,
|
F: Future<Output = crate::Result<()>> + Send + 'static,
|
||||||
{
|
{
|
||||||
let handler = Self {
|
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))
|
Box::pin(f(bot, msg, db, dialogue, val))
|
||||||
})),
|
})),
|
||||||
previous: previous.into(),
|
previous: previous.into(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user