Skip to content

Commit

Permalink
fix(middleware): expect Into<Flow> instead of Flow
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrielFR committed Jan 28, 2025
1 parent a0f93f8 commit 3d8a502
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/ferogram/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ pub trait Middleware: CloneMiddleware + Send + Sync + 'static {
}

#[async_trait]
impl<Fut: Clone, Output> Middleware for Fut
impl<T: Clone, F, O> Middleware for T
where
Fut: for<'a> FnMut(&'a Client, &'a Update, &'a mut Injector) -> Output + Send + Sync + 'static,
Output: Future<Output = Flow> + Send,
T: for<'a> FnMut(&'a Client, &'a Update, &'a mut Injector) -> F + Send + Sync + 'static,
F: Future<Output = O> + Send,
O: Into<Flow>,
{
async fn handle(&mut self, client: &Client, update: &Update, injector: &mut Injector) -> Flow {
self(client, update, injector).await.into()
Expand Down

0 comments on commit 3d8a502

Please sign in to comment.