diff options
Diffstat (limited to 'tokio-util/src/codec/length_delimited.rs')
-rw-r--r-- | tokio-util/src/codec/length_delimited.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tokio-util/src/codec/length_delimited.rs b/tokio-util/src/codec/length_delimited.rs index 04061c0a..5e98d4a7 100644 --- a/tokio-util/src/codec/length_delimited.rs +++ b/tokio-util/src/codec/length_delimited.rs @@ -546,12 +546,11 @@ impl Decoder for LengthDelimitedCodec { } } -impl Encoder for LengthDelimitedCodec { - type Item = Bytes; +impl Encoder<Bytes> for LengthDelimitedCodec { type Error = io::Error; fn encode(&mut self, data: Bytes, dst: &mut BytesMut) -> Result<(), io::Error> { - let n = (&data).remaining(); + let n = data.len(); if n > self.builder.max_frame_len { return Err(io::Error::new( |