What's the idiomatic way of passing data from a layer to the actual service implementation?
- Dominant language
- Rust
- Stars
- 12.5k
- Forks
- 1.3k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 24
Description
I'm looking at this example where you use a tower layer to do some async processing before a request (in my case I want to check if a use is authenticated).
However, one problem I'm facing with the tower layer is that _I don't know how to pass the result to the Service. In the example below, you can do some 'extra work', but you just pass the request further up the stack of layers. For instance, I want to be able to pass a user ID up the stack.
https://github.com/hyperium/tonic/blob/master/examples/src/tower/server.rs#L105
In the above example, you pass a `hyper::Request`, which doesn't really have anyway of attaching metadata (beyond something silly like adding it to the headers).
Contributor guide
Assessment
This issue has not been assessed yet.