axum-folder-router/tests/expand/simple.expanded.rs
Tristan Druyen daf793eb06
Vastly improve testing
- simplify some examples
- add macrotest for expanding/snapshotting macro expansion & add tests
  - add workaround to enable referencing relative dirs from macrotest files
  - ensure workaround doesn't get built in release
- add trybuild for testing error messages & add tests
- fix indeterministic macro output
  - sort routes after collecting
  - use BTreeMap instead of HashMap to preserve insertion order
- fix compile_error syntax error
2025-04-15 13:33:40 +02:00

33 lines
936 B
Rust

use axum_folder_router::folder_router;
struct AppState;
#[automatically_derived]
impl ::core::clone::Clone for AppState {
#[inline]
fn clone(&self) -> AppState {
AppState
}
}
#[path = "/home/tristand/code/axum-folder-router/examples/simple/api"]
mod __folder_router__myfolderrouter__examples_simple_api {
#[path = "route.rs"]
pub mod route {
use axum::response::{Html, IntoResponse};
pub async fn get() -> impl IntoResponse {
Html("<h1>Hello World!</h1>").into_response()
}
}
}
struct MyFolderRouter();
impl MyFolderRouter {
pub fn into_router() -> axum::Router<AppState> {
let mut router = axum::Router::new();
router = router
.route(
"/",
axum::routing::get(
__folder_router__myfolderrouter__examples_simple_api::route::get,
),
);
router
}
}