mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
codec: change Encoder to take &Item (#1746)
Co-authored-by: Markus Westerlind <[email protected]>
This commit is contained in:
co-authored by
Markus Westerlind
parent
1eb6131321
commit
9d4d076189
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user