mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-06 02:35:42 +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 |
||
---|---|---|
.. | ||
double_via_attr.rs | ||
double_via_attr.stderr | ||
enum_from_request_ident_in_variant.rs | ||
enum_from_request_ident_in_variant.stderr | ||
enum_from_request_on_variant.rs | ||
enum_from_request_on_variant.stderr | ||
enum_no_via.rs | ||
enum_no_via.stderr | ||
generic.rs | ||
generic.stderr | ||
generic_without_via.rs | ||
generic_without_via.stderr | ||
generic_without_via_rejection.rs | ||
generic_without_via_rejection.stderr | ||
not_enum_or_struct.rs | ||
not_enum_or_struct.stderr | ||
override_rejection_on_enum_without_via.rs | ||
override_rejection_on_enum_without_via.stderr | ||
parts_extracting_body.rs | ||
parts_extracting_body.stderr | ||
state_infer_multiple_different_types.rs | ||
state_infer_multiple_different_types.stderr | ||
unknown_attr_container.rs | ||
unknown_attr_container.stderr | ||
unknown_attr_field.rs | ||
unknown_attr_field.stderr | ||
via_on_container_and_field.rs | ||
via_on_container_and_field.stderr |