mirror of
https://github.com/tokio-rs/axum.git
synced 2024-11-25 00:28:07 +01:00
c3f3db79ec
* Support `State` with `#[derive(FromRequest[Parts])]` Fixes https://github.com/tokio-rs/axum/issues/1314 This makes it possible to extract things via `State` in `#[derive(FromRequet)]`: ```rust struct Foo { state: State<AppState>, } ``` The state can also be inferred in a lot of cases so you only need to write: ```rust struct Foo { // since we're using `State<AppState>` we know the state has to be // `AppState` state: State<AppState>, } ``` Same for ```rust struct Foo { #[from_request(via(State))] state: AppState, } ``` And ```rust struct AppState {} ``` I think I've covered all the edge cases but there are (unsurprisingly) a few. * make sure things can be combined with other extractors * main functions in ui tests don't need to be async * Add test for multiple identicaly state types * Add failing test for multiple states
35 lines
1 KiB
TOML
35 lines
1 KiB
TOML
[package]
|
|
categories = ["asynchronous", "network-programming", "web-programming"]
|
|
description = "Macros for axum"
|
|
edition = "2021"
|
|
rust-version = "1.60"
|
|
homepage = "https://github.com/tokio-rs/axum"
|
|
keywords = ["axum"]
|
|
license = "MIT"
|
|
name = "axum-macros"
|
|
readme = "README.md"
|
|
repository = "https://github.com/tokio-rs/axum"
|
|
version = "0.3.0-rc.1" # remember to also bump the version that axum and axum-extra depends on
|
|
|
|
[lib]
|
|
proc-macro = true
|
|
|
|
[dependencies]
|
|
heck = "0.4"
|
|
proc-macro2 = "1.0"
|
|
quote = "1.0"
|
|
syn = { version = "1.0", features = [
|
|
"full",
|
|
# needed for `Hash` impls
|
|
"extra-traits",
|
|
] }
|
|
|
|
[dev-dependencies]
|
|
axum = { path = "../axum", version = "0.6.0-rc.2", features = ["headers"] }
|
|
axum-extra = { path = "../axum-extra", version = "0.4.0-rc.1", features = ["typed-routing", "cookie-private"] }
|
|
rustversion = "1.0"
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
syn = { version = "1.0", features = ["full", "extra-traits"] }
|
|
tokio = { version = "1.0", features = ["full"] }
|
|
trybuild = "1.0.63"
|