mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-28 07:20:12 +01:00
17 lines
371 B
Rust
17 lines
371 B
Rust
use axum::{extract::State, routing::get, Router};
|
|
use axum_macros::FromRequest;
|
|
|
|
fn main() {
|
|
let _: axum::Router = Router::new()
|
|
.route("/", get(|_: Extractor| async {}))
|
|
.with_state(AppState::default());
|
|
}
|
|
|
|
#[derive(FromRequest)]
|
|
struct Extractor {
|
|
#[from_request(via(State))]
|
|
state: AppState,
|
|
}
|
|
|
|
#[derive(Clone, Default)]
|
|
struct AppState {}
|