Commit Graph
6 Commits
Author SHA1 Message Date
David Pedersen f4716084a7 Add middleware::from_fn for creating middleware from async fns (#656)
* Add `middleware::from_fn` for creating middleware from async fns

* More trait impls for `Next`

* Make `Next::run` consume `self`

* Use `.router_layer` in example, since middleware returns early

* Actually `Next` probably shouldn't impl `Clone` and `Service`

Has implications for backpressure and stuff

* Simplify `print-request-response` example

* Address review feedback

* add changelog link
2021-12-27 14:01:26 +01:00
David Pedersen 96b353b556 Add Cached extractor (#565)
* extra: Add `Cached` extractor

`Cached` wraps another extractor and caches its result in request
extensions.

* Use newtype to avoid overriding extensions of the same type

* Rename type param
2021-11-25 10:14:31 +00:00
Jonas Platte 69fee5864d Use .to_owned() instead of .to_string() to turn &str into String (#548) 2021-11-19 22:15:47 +00:00
David Pedersen f9a437d081 Add Resource to axum-extra (#538) 2021-11-17 22:31:43 +00:00
Jonas Platte b43b9ed69d Add axum_extra::response::ErasedJson (#537) 2021-11-17 22:54:02 +01:00
David Pedersen a16ea65031 Add axum-extra crate (#536)
* Add `axum-extra` crate

Empty for now but now we have a place to put stuff.

I'll make a PR for moving over https://github.com/davidpdrsn/axum-resource.

* remove `authors` field from `Cargo.toml`s
2021-11-17 20:00:32 +00:00