Commit graph

9 commits

Author SHA1 Message Date
David Pedersen
568394a28e
Support changing state type in #[debug_handler] (#1271)
* support setting body type for #[debug_handler]

* Use lookahead1 to give better errors and detect duplicate arguments

* fix docs link
2022-08-18 11:41:14 +02:00
David Pedersen
e7f1c88cd4
Always store state in an Arc (#1270)
* Add extension and state benchmarks

* wip

* Arc the state everywhere

* don't require `S: Clone`

* fix example
2022-08-17 20:08:24 +00:00
David Pedersen
423308de3c
Add type safe state extractor (#1155)
* begin threading the state through

* Pass state to extractors

* make state extractor work

* make sure nesting with different states work

* impl Service for MethodRouter<()>

* Fix some of axum-macro's tests

* Implement more traits for `State`

* Update examples to use `State`

* consistent naming of request body param

* swap type params

* Default the state param to ()

* fix docs references

* Docs and handler state refactoring

* docs clean ups

* more consistent naming

* when does MethodRouter implement Service?

* add missing docs

* use `Router`'s default state type param

* changelog

* don't use default type param for FromRequest and RequestParts

probably safer for library authors so you don't accidentally forget

* fix examples

* minor docs tweaks

* clarify how to convert handlers into services

* group methods in one impl block

* make sure merged `MethodRouter`s can access state

* fix docs link

* test merge with same state type

* Document how to access state from middleware

* Port cookie extractors to use state to extract keys (#1250)

* Updates ECOSYSTEM with a new sample project (#1252)

* Avoid unhelpful compiler suggestion (#1251)

* fix docs typo

* document how library authors should access state

* Add `RequestParts::with_state`

* fix example

* apply suggestions from review

* add relevant changes to axum-extra and axum-core changelogs

* Add `route_service_with_tsr`

* fix trybuild expectations

* make sure `SpaRouter` works with routers that have state

* Change order of type params on FromRequest and RequestParts

* reverse order of `RequestParts::with_state` args to match type params

* Add `FromRef` trait (#1268)

* Add `FromRef` trait

* Remove unnecessary type params

* format

* fix docs link

* format examples

* Avoid unnecessary `MethodRouter`

* apply suggestions from review

Co-authored-by: Dani Pardo <dani.pardo@inmensys.com>
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2022-08-17 15:13:31 +00:00
Jonas Platte
7795e649f6
Avoid unhelpful compiler suggestion (#1251) 2022-08-12 10:06:38 +00:00
David Pedersen
698b5ccf39 Update trybuilds for rust 1.62 2022-07-01 10:24:15 +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
07e8a6d8fe Update trybuild test to rust 1.59 output 2022-02-25 11:30:10 +01:00
David Pedersen
f6fc5ed80c
Move axum-debug into axum-macros (#724)
* Move axum-debug into axum-macros

* fix ref to axum-macros in changelog

* Apply suggestions from code review

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

Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
2022-01-26 23:27:22 +01:00