Commit Graph
79 Commits
Author SHA1 Message Date
Jonas Platte 72e820f6fa Bump nightly for axum-macros (#3500) 2025-09-28 20:31:17 +02:00
Jonas Platte 4ab8df5e42 Switch serde dependency to serde_core (#3477) 2025-09-14 08:49:07 +02:00
Kyle Nweeia 0832de443c Use via extractor's rejection instead of axum::response::Response (#3261) 2025-07-16 09:50:59 +00:00
Tobias Bieniek 33b353def8 Update docs.rs links to 0.8 (#3120) 2024-12-27 13:15:58 +01:00
Jonas Platte ec75ee3827 Add a separate trait for optional extractors (#2475) 2024-12-10 02:54:59 +00:00
Jonas Platte fb1b8f1a55 Remove unused import in trybuild test (#3050) 2024-11-26 20:47:43 +01:00
Jonas Platte 9ddb25f089 Re-format trybuild tests (#3049) 2024-11-26 18:04:01 +00:00
David Mládek 6318b57fda chore: Upgrade matchit to 0.8 (#2645) 2024-10-03 15:46:58 +00:00
Zheng LiandJonas Platte 19101f624d Replace async_trait with AFIT / RPITIT (#2308)
Co-authored-by: Jonas Platte <[email protected]>
2024-09-28 21:27:11 +00:00
Jonas Platte 8b1cad656f Bump nightly version used for ui tests (#2805) 2024-09-11 20:41:44 +02:00
AlphaKeks 74eac39e06 Fix clippy warning on FromRef derive macro (#2827) 2024-07-09 23:08:59 +02:00
Jonas PlatteandLogan Nielsen 34e11c50b5 Add Extension<NonCloneType> debug_handler ui test (#2731)
Co-authored-by: Logan Nielsen <[email protected]>
2024-06-09 20:17:43 +02:00
Yann SimonandDavid Pedersen df612fdc72 Add #[debug_middleware] (#2725)
Co-authored-by: David Pedersen <[email protected]>
2024-05-02 17:27:12 -04:00
mikihiro c6fd852844 Update sync_wrapper to 1.0.0 from 0.1.1
... and fix CI.
2024-03-23 19:46:20 +01:00
David Mládek 3569950a2e Make nightly_error_messages feature compatible with latest nightly 2024-03-14 21:19:03 +01:00
d2cea5cdbd Improve debug_handler on tuple response types (#2201)
Co-authored-by: David Pedersen <[email protected]>
Co-authored-by: Jonas Platte <[email protected]>
2023-12-30 21:48:35 +00:00
David Pedersen 85573e0573 impl IntoResponseParts for () (#2471) 2023-12-30 17:47:22 +00:00
David Pedersen 12e8c6219d Support graceful shutdown on serve (#2398) 2023-12-29 11:17:58 +00:00
Justin Sexton f98bc1186a Updated doc link versions to use more explicit 0.7 version. (#2379) 2023-11-29 09:31:17 +00:00
David Pedersen 15781fe22b Prepare serve for potentially supporting graceful shutdown (#2357) 2023-11-26 12:21:35 +00:00
David Pedersen ff9764574c Implement FromRequestParts for Parts and Extensions (#2328) 2023-11-23 11:30:23 +00:00
43b14a5f02 Update to latest versions of hyper and http-body (#1882)
Co-authored-by: Michael Scofield <[email protected]>
Co-authored-by: Jonas Platte <[email protected]>
2023-11-23 11:03:03 +00:00
Mikhail Antoshkin c100650464 Fix items-after-test-module clippy warning on 1.75.0-beta.1 (#2318) 2023-11-16 07:15:16 +00:00
Georg Semmler 2f6200dfbd Use the diagnostic namespace (#2246) 2023-09-29 09:25:26 +02:00
David Pedersen cc611b8b24 Implement IntoResponse for (R,) where R: IntoResponse (#2143) 2023-08-03 18:15:06 +00:00
Jonas Platte 432289dd04 Replace :emoji: codes with the actual emoji (#2144) 2023-08-03 08:23:18 +00:00
二手掉包工程师 5503b3236b Fix CI (#2086)
- Use exactly version 1.0.0-rc.3 of hyper
- Update expected output of UI tests
- Fix clippy lints

Signed-off-by: hi-rustin <[email protected]>
2023-07-13 16:53:22 +02:00
Alexander JacksonandDavid Pedersen 68696b09b1 Allow unreachable code in #[debug_handler] (#2014)
Co-authored-by: David Pedersen <[email protected]>
2023-06-22 21:51:52 +00:00
877e3fe4de Move TypedHeader to axum-extra (#1850)
Co-authored-by: Michael Scofield <[email protected]>
Co-authored-by: Jonas Platte <[email protected]>
2023-04-21 17:45:31 +02:00
6703f8634c Remove B type param: Follow ups (#1789)
Co-authored-by: Jonas Platte <[email protected]>
Co-authored-by: Michael Scofield <[email protected]>
2023-04-21 17:45:31 +02:00
4e4c29175f Remove B type param (#1751)
Co-authored-by: Jonas Platte <[email protected]>
Co-authored-by: Michael Scofield <[email protected]>
2023-04-21 17:45:31 +02:00
David Pedersen cfb5df7050 Give better error if generics are used with #[derive(FromRef)] (#1874) 2023-03-22 14:48:27 +01:00
Jonas PlatteandDavid Pedersen a26ddd1063 Improve debug_handler message for generic request-consuming extractors (#1826)
Co-authored-by: David Pedersen <[email protected]>
2023-03-10 08:51:03 +00:00
David Pedersen 416a0568d3 Add special handling of FromRequest extractors not being the last arg (#1797) 2023-03-03 09:44:10 +01:00
David Pedersen cd86f7ec7a Use 422 Unprocessable Entity for Form deserialization errors, except GET and HEAD requests (#1683) 2023-02-17 09:59:02 +01:00
David Pedersen 0ecf5eeb19 Support passing MethodRouter to Router::fallback (#1730) 2023-02-11 23:11:55 +01:00
Jonas Platte 19596584da Update trybuild output 2023-01-30 21:47:57 +01:00
Jonas Platte bdfaedb344 Use call-site span for future Send check in debug_handler 2023-01-30 21:47:57 +01:00
David Pedersen 5b07296001 Add RawPathParams (#1713) 2023-01-20 20:37:01 +00:00
valkyrie_pilotandDavid Pedersen e4c6d76bca Implement IntoResponse for [u8; N] and &'static [u8; N] (#1690)
Co-authored-by: David Pedersen <[email protected]>
2023-01-13 09:12:51 +00:00
Alexander Jackson b6c282a2b7 Fix warnings for cloning references in generated code (#1676) 2023-01-05 11:50:02 +01:00
David Pedersen 0b26411f39 Change Router::with_state and impl Service for Router<()> (#1552)
* Implement `Service` for `Router<(), B>`

* wip

* wip

* fix some tests

* fix examples

* fix doc tests

* clean up docs

* changelog

* fix

* also call `with_state` when converting `MethodRouter` into a `MakeService`

* suggestions from review
2022-11-24 14:43:10 +00:00
d5de3bc7e3 Improve compile errors for unimplemented traits (#1436)
* Improve `debug_handler` to use the correct span for specific bounds

This results in better localised error messages, as they now point
directly to the corresponding argument instead of to the macro itself.

* Improve some error messages behind a `nightly-error-messages` feature
flag

This uses the nightly only `rustc_on_unimplemented` attribute to improve
some error messages when users try to use invalid handler functions.
This should be seen as prove of concept, not as full solution for all
potential error cases.

The underlying feature is currently marked as permanently unstable, but
I'm working on getting this specific attribute (or an attribute with
different name, similar functionality) ready to work on a stable compiler.

* Apply suggestions from code review

Co-authored-by: Jonas Platte <[email protected]>

* Enable the `nightly-error-messages` feature unconditionally for nightly compilers

* Use a nightly compiler to run the axum-marcos compile fail tests

* update to newer nightly

* Run axum-macros tests on nightly

* tweak compile error hints a bit

* more tweaks

* update test

Co-authored-by: Jonas Platte <[email protected]>
Co-authored-by: David Pedersen <[email protected]>
2022-11-19 12:45:03 +01:00
David Pedersen 7d58d49817 Add #[from_ref(skip)] (#1537)
For skipping individual fields.
2022-11-18 12:05:10 +01:00
David Pedersen 64960bb19c Type safe state inheritance (#1532)
* Make state type safe

* fix examples

* remove unnecessary `#[track_caller]`s

* Router::into_service -> Router::with_state

* fixup docs

* macro docs

* add missing docs

* fix examples

* format

* changelog

* Update trybuild tests

* Make sure fallbacks are still inherited for opaque services (#1540)

* Document nesting routers with different state

* fix leftover conflicts
2022-11-18 11:02:58 +00:00
David Pedersen 2e8a7e51a1 Fix Handler::with_state not working if request body was changed via layer (#1536)
Previously

```rust
handler.layer(RequestBodyLimitLayer::new(...)).with_state(...)
```

didn't work because we required the same request body all the way
through.
2022-11-18 11:00:52 +01:00
David Pedersen e0ef641e5f Rework Form and Query rejections (#1496)
* Change `FailedToDeserializeQueryString` rejection for `Form`

Its now called `FailedToDeserializeForm`.

* changelog

* Make dedicate rejection type for axum-extra's `Form`

* update trybuild test

* Make dedicate rejection type for axum-extra's `Query`
2022-11-08 20:31:06 +00:00
David Pedersen a27bd2c6a2 Update trybuild tests for Rust 1.65.0 (#1509) 2022-11-04 09:07:57 +01:00
Marek KuskowskiandDavid Pedersen bc8a507f58 Add RawForm extractor (#1487)
* Add RawForm extractor

* Change RawForm(String) to RawForm(Option<String>)

* Fix tests

* Use Bytes instead of Option<String> and add tests

* Add test for empty body

* Update CHANGELOG

* small docs tweaks

* changelog nit

Co-authored-by: David Pedersen <[email protected]>
2022-10-20 18:03:13 +00:00
David Pedersen 9c0a89cd09 Add #[derive(FromRef)] (#1430)
* add `#[derive(FromRef)]`

* tests

* don't support skipping fields

probably wouldn't work at all since the whole state likely needs `Clone`

* UI tests

* changelog

* changelog link

* revert hello-world example, used for testing

* Re-export `#[derive(FromRef)]`

* Don't need to return `Result`

* use `collect` instead of quoting the iterator

* Mention it in axum's changelog
2022-10-10 18:40:14 +00:00