diff options
-rw-r--r-- | src/server.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/server.rs b/src/server.rs index 46f1f76..e9b05d8 100644 --- a/src/server.rs +++ b/src/server.rs @@ -28,29 +28,25 @@ async fn handle_req(req: Request) -> Result<Response> { Ok(Response::ok("Done")?) } -struct Echo; +struct Echo; impl Service<Request> for Echo { type Response = Response; - type Error = Box<dyn Error + Send + Sync>; - type Future = Pin<Box<dyn futures::Future<Output = Result<Self::Response, Self::Error>> + Send>>; + type Error = anyhow::Error; + type Future = Pin<Box<dyn futures::Future<Output = Result<Self::Response>> + Send>>; fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { Poll::Ready(Ok(())) } fn call(&mut self, req: Request) -> Self::Future { - Box::pin(Echo::handle_req(req)) - } -} - -impl Echo { - async fn handle_req(req: Request) -> Result<Response, Box<dyn Error + Send + Sync>> { println!("Got request: {:#?}", req); - Ok(Response::ok("Done").unwrap()) + let fut = futures::future::ok(Response::ok("Done").unwrap()); + Box::pin(fut) } } + impl Server { pub fn new(config: Config) -> Result<Arc<Self>> { let s3_region = Region::Custom { |