Commit graph

48 commits

Author SHA1 Message Date
Jonas Platte
a73dab417d
Bump versions 2024-09-20 21:25:30 +02:00
Yann Simon
df612fdc72
Add #[debug_middleware] (#2725)
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2024-05-02 17:27:12 -04:00
David Pedersen
9ebd105d04
Release (#2510) 2024-01-13 14:31:03 +01:00
Sleep_AllDay
d2cea5cdbd
Improve debug_handler on tuple response types (#2201)
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2023-12-30 21:48:35 +00:00
David Pedersen
b7d14d3602
Release axum 0.7 (#2354) 2023-11-27 09:30:38 +01:00
David Pedersen
1a78e093ed
Apply changelog changes from 0.6 branch to main (#2353) 2023-11-25 20:44:07 +01:00
David Pedersen
4290955cf0 Add missing changes to changelog 2023-07-16 12:54:53 +02:00
David Pedersen
6703f8634c Remove B type param: Follow ups (#1789)
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: Michael Scofield <mscofield0@tutanota.com>
2023-04-21 17:45:31 +02:00
David Pedersen
4e4c29175f Remove B type param (#1751)
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
Co-authored-by: Michael Scofield <mscofield0@tutanota.com>
2023-04-21 17:45:31 +02:00
David Pedersen
562fa206f0
Release axum, axum-extra, axum-macros (#1875) 2023-03-22 15:22:47 +01:00
David Pedersen
cfb5df7050
Give better error if generics are used with #[derive(FromRef)] (#1874) 2023-03-22 14:48:27 +01:00
David Pedersen
8e1eb8979f
Update to syn 2 (#1862) 2023-03-18 19:23:27 +00:00
David Pedersen
1133425d6b
Release axum, axum-macros, and axum-extra (#1843) 2023-03-13 11:00:13 +01:00
Jonas Platte
a26ddd1063
Improve debug_handler message for generic request-consuming extractors (#1826)
Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2023-03-10 08:51:03 +00:00
David Pedersen
bc3c35ea5a
Release all the crates (#1812) 2023-03-03 18:16:24 +01: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
c18ff9dd63
Release axum, axum-extra, and axum-macros (#1750) 2023-02-12 12:40:42 +01:00
David Pedersen
93ecabf449
Release axum and axum-macros (#1743) 2023-02-11 22:32:16 +01:00
David Pedersen
4a5dc4391c
Release axum and axum-macros (#1721) 2023-01-24 13:31:33 +01:00
David Pedersen
e3aaeb3cb7
Release axum, axum-core, and axum-macros (#1688) 2023-01-09 13:54:49 +01:00
David Pedersen
1b6780cf6c
axum 0.6 and friends 🎉 (#1570)
* changelog

* bump versions

* reorder changelogs a bit

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* Expand fallback inheritance

* Reword tsr

* Mention `parse-body-based-on-content-type` example

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-11-25 12:29:58 +00:00
David Pedersen
878ae73e6d
New release candidates (#1541) 2022-11-18 17:29:47 +01:00
David Pedersen
7d58d49817
Add #[from_ref(skip)] (#1537)
For skipping individual fields.
2022-11-18 12:05:10 +01:00
David Pedersen
e39d053d2f
New release candidates (#1514)
* New release candidates

* Update axum/Cargo.toml

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-11-09 09:01:47 +01: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
David Pedersen
b315b60bca
Bump version of all crates (#1310)
* Bump version of all crates

* use the right versions inside the workspace
2022-08-23 22:57:13 +02:00
Jonas Platte
7705ef6661
Add #[derive(FromRequestParts)] (#1305)
* Add missing leading double colon

* Separate handling of last element in FromRequest derive

* FromRequestParts derive

* fix it and add lots of tests

* docs

* changelog

* Update axum-macros/src/lib.rs

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2022-08-23 19:14:02 +00:00
David Pedersen
be624306f4
Only allow last extractor to mutate the request (#1272)
* Only allow last extractor to mutate the request

* Change `FromRequest` and add `FromRequestParts` trait (#1275)

* Add `Once`/`Mut` type parameter for `FromRequest` and `RequestParts`

* 🪄

* split traits

* `FromRequest` for tuples

* Remove `BodyAlreadyExtracted`

* don't need fully qualified path

* don't export `Once` and `Mut`

* remove temp tests

* depend on axum again

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* Port `Handler` and most extractors (#1277)

* Port `Handler` and most extractors

* Put `M` inside `Handler` impls, not trait itself

* comment out tuples for now

* fix lints

* Reorder arguments to `Handler` (#1281)

I think `Request<B>, Arc<S>` is better since its consistent with
`FromRequest` and `FromRequestParts`.

* Port most things in axum-extra (#1282)

* Port `#[derive(TypedPath)]` and `#[debug_handler]` (#1283)

* port #[derive(TypedPath)]

* wip: #[debug_handler]

* fix #[debug_handler]

* don't need itertools

* also require `Send`

* update expected error

* support fully qualified `self`

* Implement FromRequest[Parts] for tuples (#1286)

* Port docs for axum and axum-core (#1285)

* Port axum-extra (#1287)

* Port axum-extra

* Update axum-core/Cargo.toml

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* remove `impl FromRequest for Either*`

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* New FromRequest[Parts] trait cleanup (#1288)

* Make private module truly private again

* Simplify tuple FromRequest implementation

* Port `#[derive(FromRequest)]` (#1289)

* fix tests

* fix docs

* revert examples

* fix docs link

* fix intra docs links

* Port examples (#1291)

* Document wrapping other extractors (#1292)

* axum-extra doesn't need to depend on axum-core (#1294)

Missed this in https://github.com/tokio-rs/axum/pull/1287

* Add `FromRequest` changes to changelogs (#1293)

* Update changelog

* Remove default type for `S` in `Handler`

* Clarify which types have default types for `S`

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* remove unused import

* Rename `Mut` and `Once` (#1296)

* fix trybuild expected output

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-08-22 12:23:20 +02:00
David Pedersen
ac7037d282
Support using a different rejection for #[derive(FromRequest)] (#1256) 2022-08-12 16:05:27 +00:00
Jonas Platte
7cbb7cf135
Use new Cargo features to avoid implicit features for optional dependencies (#1239)
* Fix changelog entry for MSRV change in axum-extra 0.3.5

* Bump MSRV to 1.60 for axum, axum-extra, axum-macros

* Use new Cargo features to avoid implicit features for optional dependencies
2022-08-09 18:43:02 +02:00
David Pedersen
b10c9d34bd
axum-macros: Version 0.2.3 (#1126) 2022-06-27 21:06:59 +02:00
David Pedersen
11179b8033
Silence "unnecessary use of to_string" lint for #[derive(TypedPath)] (#1117)
* Fix "unnecessary use of `to_string`" lint for `#[derive(TypedPath)]`

* changelog

* Update axum-macros/CHANGELOG.md
2022-06-27 18:57:02 +00:00
David Pedersen
93251fa203
Bump MSRV to 1.56 and update to the 2021 edition (#1098) 2022-06-17 20:11:35 +02:00
Jonas Platte
80d0cc19e6
axum-macros: 0.2.2 (#1044) 2022-05-18 20:23:56 +02:00
David Pedersen
5948cde6c1
Support customizing rejections for #[derive(TypedPath)] (#1012)
* Support customizing rejections for `#[derive(TypedPath)]`

* changelog

* clean up
2022-05-17 21:36:05 +02:00
David Pedersen
7d88bd3a66
Check for multiple body extractors in debug_handler (#1036)
* Check for multiple body extractors in `debug_handler`

* changelog link
2022-05-16 14:11:40 +00:00
David Pedersen
05529c8efc
Check Request and Path in debug_handler (#1035)
* Check `Request` and `Path` in `debug_handler`

* changelog links

* Include errors with the input
2022-05-16 10:05:17 +00:00
David Pedersen
46e6d3493b
axum-macros: Version 0.2.1 (#1015) 2022-05-10 11:46:17 +00:00
David Pedersen
852e548e19
Support #[derive(FromRequest)] on enums (#1009)
* Support `#[from_request(via(...))]` on enums

* Check `#[from_request]` on variants

* check for non enum/struct and clean up

* changelog

* changelog

* remove needless feature

* changelog ref
2022-05-08 20:04:56 +02:00
David Pedersen
b5183afbec
Support wildcards in typed paths (#1003)
* Support wildcards in typed paths

* changelog
2022-05-06 13:05:30 +02:00
David Pedersen
4ff78e552d
Support Option and Result in typed paths (#1001)
* Support `Option` and `Result` in typed paths

* changelog

* Update axum-extra/CHANGELOG.md

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>

* fix one more

Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-05-06 09:42:10 +02:00
David Pedersen
f69d2dbf40 axum-macros: Version 0.2.0 2022-03-31 20:45:01 +02:00
David Pedersen
d7860ea9e2
Copy over changelogs from v0.4.x branch (#893)
* Copy over changelogs from v0.4.x branch

Preparing to release 0.5

* bump crate versions
2022-03-31 20:21:55 +02:00
David Pedersen
90e74f12c4
Requires paths start with a / (#823)
* Requires routes to start with `/`

* Also check routes in `TypedPath`

* changelog

* changelog links
2022-03-03 23:24:27 +00:00
David Pedersen
da74084146
Easily convert typed paths into URIs (#790)
* Easily convert typed paths into URIs

`#[derive(TypedPath)]` will now also generate `TryFrom<_> for Uri` for
easily converting paths into URIs for use with `Redirect` and friends.

Fixes https://github.com/tokio-rs/axum/issues/789

* Use a method on the `TypedPath` trait to convert to `Uri`

* fix doc ref

* Update changelogs
2022-02-28 09:58:22 +01:00
David Pedersen
7a228a584b
Type safe routing (#756)
* wip

* wip

* make macro implement trait

* checkpoint

* checkpoint

* Simplify things quite a bit

* re-export `axum_macros::TypedPath` from `axum_extra`

* docs

* add missing feature

* fix docs link

* fix features

* fix missing imports

* make serde an optional dep again

* ui tests

* Break things up a bit

* Update span for `FromRequest` impls to point to callsite

* make docs feature labels show up automatically

* Apply suggestions from code review

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* add note about Display/Serialize being compatible

* Update axum-extra/src/routing/typed.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* fix missing docs link

* what about typed methods?

* Revert "what about typed methods?"

This reverts commit cc1f989467.

* don't allow wildcards for now

* percent encode params

* Update axum-extra/src/routing/typed.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* rephrase args

* changelog

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-02-18 14:13:56 +01:00
David Pedersen
c1cc4b515a Update axum-macros changelog with initial release date 2022-01-31 20:06:59 +01:00
David Pedersen
e4c389c94d
Add axum-macros crate with #[derive(FromRequest)] (#718)
* initial working impl

* support `#[from_request(via(...))]`

* support extracting the whole thing at once

* rely on type inference

* fix footgun

* fix typo

* generate rejection enums

* move tests to trybuild

* minor clean up

* docs

* Support multiple generic extractors with same "via" type

* support `Result` as well

* Update axum-macros/src/from_request.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* Add `#[automatically_derived]`

* remove needless `#[derive(Debug)]` on macro types

* Fix error messages that different for some reason

* Update axum-macros/src/lib.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* add more `#[automatically_derived]`

* support same types in tuple structs

* update docs

* prep axum-macros for release

* address review feedback

* Update axum-macros/src/lib.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* Update axum-macros/src/lib.rs

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>

* Update known limitation

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-25 15:05:50 +01:00