Don't force handlers to return Results

This commit is contained in:
David Pedersen
2021-05-31 20:42:57 +02:00
parent 6f5b2708d5
commit d33be9683c
6 changed files with 26 additions and 21 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ use hyper::Server;
use std::net::SocketAddr;
use tower::{make::Shared, ServiceBuilder};
use tower_http::trace::TraceLayer;
use tower_web::{body::Body, response::Html, Error};
use tower_web::{body::Body, response::Html};
#[tokio::main]
async fn main() {
@@ -28,6 +28,6 @@ async fn main() {
server.await.unwrap();
}
async fn handler(_req: Request<Body>) -> Result<Html<&'static str>, Error> {
Ok(Html("<h1>Hello, World!</h1>"))
async fn handler(_req: Request<Body>) -> Html<&'static str> {
Html("<h1>Hello, World!</h1>")
}