Handler::func no longer requires a closure to be sync
This commit is contained in:
		@@ -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(),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user