went to give maud a shot today and it looks like axum is unhappy with it for now.
use axum::{
routing::{get, post},
http::StatusCode,
Json, Router,
};
use serde::{Deserialize, Serialize};
use maud::{html, Markup};
async fn hello_world() -> Markup {
html! {
h1 { "Hello, World!" }
}
}
#[tokio::main]
async fn main() {
// build our application with a route
let app = Router::new()
.route("/", get(hello_world));
// run our app with hyper
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
error[E0277]: the trait bound fn() -> impl Future<Output = PreEscaped<std::string::String>> {hello_world}: Handler<_, _> is not satisfied
--> src/main.rs:14:25
14
.route("/", get(hello_world));
--- ^^^^^^^^^^^ the trait Handler<_, _> is not implemented for fn item fn() -> impl Future<Output = PreEscaped<std::string::String>> {hello_world}
required by a bound introduced by this call
= help: the following other types implement trait `Handler<T, S>`:
<Layered<L, H, T, S> as Handler<T, S>>
<MethodRouter<S> as Handler<(), S>>
Reverting to axum 0.6.2 fixed things, so maybe an update to the website to state version compatibility would be nice.
I have no idea how to go about implementing the handler trait for Markup.
went to give maud a shot today and it looks like axum is unhappy with it for now.
fn() -> impl Future<Output = PreEscaped<std::string::String>> {hello_world}: Handler<_, _>
is not satisfied --> src/main.rs:14:25Handler<_, _>
is not implemented for fn itemfn() -> impl Future<Output = PreEscaped<std::string::String>> {hello_world}
Reverting to axum 0.6.2 fixed things, so maybe an update to the website to state version compatibility would be nice. I have no idea how to go about implementing the handler trait for Markup.