David Pedersen
cfb5df7050
Give better error if generics are used with #[derive(FromRef)] ( #1874 )
2023-03-22 14:48:27 +01: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
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
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