feat(build): Custom codecs for generated code (#1599)* feat(tonic): Custom codecs for generated codeBroadly, this change does 2 things:1. Allow the built-in Prost codec to have its buffer sizes
feat(build): Custom codecs for generated code (#1599)* feat(tonic): Custom codecs for generated codeBroadly, this change does 2 things:1. Allow the built-in Prost codec to have its buffer sizes customized2. Allow users to specify custom codecs on the tonic_build::prost::BuilderThe Prost codec is convenient, and handles any normal use case. However,the buffer sizes today are too large in some cases - and they may grow tooaggressively. By exposing BufferSettings, users can make a small customcodec with their own BufferSettings to control their memory usage - or giveenormous buffers to rpc's, as their use case requires.While one can define a custom service and methods with a custom codec todayexplicitly in Rust, the code generator does not have a means to supply acustom codec. I've reached for .codec... on the tonic_build::prost::Buildermany times and keep forgetting it's not there. This change adds .codec_pathto the Builder, so people can simply add their custom buffer codec or eventheir own full top level codec without reaching for manual service definition.* replace threadlocal with service wrapper* pull back ProstEn/Decoder, clean up other comments* clippy and fmt* feedback, clean up straggler changes
show more ...