mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
@@ -21,7 +21,7 @@ impl Decoder for U32Codec {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
let n = buf.split_to(4).into_buf().get_u32::<BigEndian>();
|
let n = buf.split_to(4).into_buf().get_u32_be();
|
||||||
Ok(Some(n))
|
Ok(Some(n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ impl Encoder for U32Codec {
|
|||||||
fn encode(&mut self, item: u32, dst: &mut BytesMut) -> io::Result<()> {
|
fn encode(&mut self, item: u32, dst: &mut BytesMut) -> io::Result<()> {
|
||||||
// Reserve space
|
// Reserve space
|
||||||
dst.reserve(4);
|
dst.reserve(4);
|
||||||
dst.put_u32::<BigEndian>(item);
|
dst.put_u32_be(item);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,4 +94,3 @@ fn external_buf_does_not_shrink() {
|
|||||||
|
|
||||||
assert_eq!(readbuf.capacity(), INITIAL_CAPACITY * 2);
|
assert_eq!(readbuf.capacity(), INITIAL_CAPACITY * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ impl Encoder for U32Encoder {
|
|||||||
fn encode(&mut self, item: u32, dst: &mut BytesMut) -> io::Result<()> {
|
fn encode(&mut self, item: u32, dst: &mut BytesMut) -> io::Result<()> {
|
||||||
// Reserve space
|
// Reserve space
|
||||||
dst.reserve(4);
|
dst.reserve(4);
|
||||||
dst.put_u32::<BigEndian>(item);
|
dst.put_u32_be(item);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ fn write_hits_backpressure() {
|
|||||||
|
|
||||||
for i in 0..(ITER + 1) {
|
for i in 0..(ITER + 1) {
|
||||||
let mut b = BytesMut::with_capacity(4);
|
let mut b = BytesMut::with_capacity(4);
|
||||||
b.put_u32::<BigEndian>(i as u32);
|
b.put_u32_be(i as u32);
|
||||||
|
|
||||||
// Append to the end
|
// Append to the end
|
||||||
match mock.calls.back_mut().unwrap() {
|
match mock.calls.back_mut().unwrap() {
|
||||||
|
|||||||
Reference in New Issue
Block a user