Commit Graph
13 Commits
Author SHA1 Message Date
David Pedersen d843f4378b Make websocket handlers support extractors (#41) 2021-07-30 15:19:53 +02:00
David Pedersen 8faed8120f Docs improvements (#37) 2021-07-22 15:00:33 +02:00
David Pedersen f32d325e55 Make extractors easier to write (#36)
Previously extractors worked directly on `Request<B>` which meant you
had to do weird tricks like `mem::take(req.headers_mut())` to get owned
parts of the request.

This changes that instead to use a new `RequestParts` type that have
methods to "take" each part of the request. Without having to do weird
tricks.

Also removed the need to have `B: Default` for body extractors.
2021-07-22 13:23:50 +02:00
David Pedersen 5a5710d290 Rename to axum (#28) 2021-07-09 21:36:14 +02:00
David Pedersen 3cd4a1d6a6 Fix for service as bottom handler (#27)
Would previously fail because of a mismatch in error types.
2021-07-06 09:40:25 +02:00
David Pedersen c4d266e94d Allow errors (#26)
This changes error model to actually allow errors. I think if we're going to use this for things like tonic's route we need a more flexible error handling model. The same `handle_error` adaptors are still there but services aren't required to have `Infallible` as their error type. The error type is simply propagated all the way through.
2021-07-05 16:18:39 +02:00
David Pedersen 356f1c8424 Generic request body (#22)
Fixes #21
2021-06-19 12:50:33 +02:00
David Pedersen 1002685a20 Rename to awebframework (#13) 2021-06-13 11:22:02 +02:00
David Pedersen 59944c231f Reduce size of response body types (#11)
Wrapping everything in `crate::body::Either` wasn't actually necessary
ans probably causes large body types. You can instead box the bodies in
the leaf services.
2021-06-13 10:10:37 +02:00
David Pedersen 04d62798b6 Reduce body boxing (#9)
Previously, when routing between one or two requests the two body types
would be merged by boxing them. This isn't ideal since it introduces a
layer indirection for each route.

We can't require the services to be routed between as not all services
use the same body type.

This changes that so it instead uses an `Either` enum that implements
`http_body::Body` if each variant does. Will reduce the overall
allocations and hopefully the compiler can optimize things if both
variants are the same.
2021-06-12 23:59:18 +02:00
David Pedersen c91dc7ce29 Make Request<Body> an extractor 2021-06-09 09:42:06 +02:00
David Pedersen 90c3e5ba74 Parameterize ContentLengthLimit 2021-06-09 08:14:20 +02:00
David Pedersen 1f8b39f05d More docs and expand key_value_store example 2021-06-08 12:43:16 +02:00