@@ -13,28 +13,6 @@ use std::{
13
13
} ;
14
14
use tokio_stream:: { adapters:: Fuse , Stream , StreamExt } ;
15
15
16
- /// Turns a stream of grpc messages into [EncodeBody] which is used by grpc clients for
17
- /// turning the messages into http frames for sending over the network.
18
- pub fn encode_client < T , U > (
19
- encoder : T ,
20
- source : U ,
21
- compression_encoding : Option < CompressionEncoding > ,
22
- max_message_size : Option < usize > ,
23
- ) -> EncodeBody < T , U >
24
- where
25
- T : Encoder < Error = Status > ,
26
- U : Stream ,
27
- {
28
- let stream = EncodedBytes :: new (
29
- encoder,
30
- source,
31
- compression_encoding,
32
- SingleMessageCompressionOverride :: default ( ) ,
33
- max_message_size,
34
- ) ;
35
- EncodeBody :: new_client ( stream)
36
- }
37
-
38
16
/// Combinator for efficient encoding of messages into reasonably sized buffers.
39
17
/// EncodedBytes encodes ready messages from its delegate stream into a BytesMut,
40
18
/// splitting off and yielding a buffer when either:
@@ -251,9 +229,22 @@ struct EncodeState {
251
229
}
252
230
253
231
impl < T : Encoder , U : Stream > EncodeBody < T , U > {
254
- fn new_client ( inner : EncodedBytes < T , U > ) -> Self {
232
+ /// Turns a stream of grpc messages into [EncodeBody] which is used by grpc clients for
233
+ /// turning the messages into http frames for sending over the network.
234
+ pub fn new_client (
235
+ encoder : T ,
236
+ source : U ,
237
+ compression_encoding : Option < CompressionEncoding > ,
238
+ max_message_size : Option < usize > ,
239
+ ) -> Self {
255
240
Self {
256
- inner,
241
+ inner : EncodedBytes :: new (
242
+ encoder,
243
+ source,
244
+ compression_encoding,
245
+ SingleMessageCompressionOverride :: default ( ) ,
246
+ max_message_size,
247
+ ) ,
257
248
state : EncodeState {
258
249
error : None ,
259
250
role : Role :: Client ,
0 commit comments