Open ERnsTL opened 3 years ago
I think it's related to tokio-rs/prost/issues/429, currently Rust protobuf generator doesn't allow you to choose the pointer, in which case you're not allowed to use Arc
for reusing value. I hope it can be implemented soon.
http::Request
is not clonable due to the Extensions
type it uses. You can though construct your proto to use bytes
and then use the bytes feature in prost to have the bytes field be Bytes
. This then would allow you to cheaply clone the bytes and avoid heavy clones.
Related issue https://github.com/hyperium/http/issues/395
Feature Request
Crates
tonic
Motivation
tonic seems slow in use-cases where many similar requests need to be sent.
Proposal
Re-use of the tonic::Request instance, just setting the payload new -- or even just overwriting some fields of the payload.
Very simple example:
Current situation: "trait Copy not implemented for struct Request" -- "value moved in previous iteration".
Alternatives
Not sure.