Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maud will need updating for Axum 7.0+ #414

Closed
SamuelKurtzer opened this issue Jan 14, 2024 · 1 comment
Closed

Maud will need updating for Axum 7.0+ #414

SamuelKurtzer opened this issue Jan 14, 2024 · 1 comment

Comments

@SamuelKurtzer
Copy link

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 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.

@kcable194
Copy link

Release 0.26.0 seems to have fixed this issues (I was running into the same thing)

@lambda-fairy lambda-fairy closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants