Skip to content

Commit

Permalink
now handler works
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-thomas committed Jan 7, 2025
1 parent 34fc523 commit cd8a446
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions titan-core/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ macro_rules! factory_tuple ({ $($param:ident)* } => {
}
}
});
impl<Func, Fut> Handler<((),)> for Func
impl<Func, Fut> Handler<()> for Func
where
Func: Fn() -> Fut + Send + 'static,
Fut: Future + Send,
{
type Future = Pin<Box<dyn Future<Output = Response> + Send>>;
type Future = Fut;
type Output = Fut::Output;

fn call(self, _req: Request, _state: S) -> Self::Future {
Box::pin(async move { self().await.into_response() })
fn call(&self, req: ()) -> Self::Future {
let _ = req;
self()
}
}

Expand Down

0 comments on commit cd8a446

Please sign in to comment.