chore: update to bytes 1.0 git branch (#3301)

Updates the code base to track the `bytes` git branch. This is in
preparation for the 1.0 release.

Closes #3058
This commit is contained in:
Carl Lerche
2020-12-19 15:57:16 -08:00
committed by GitHub
parent 5e5f513542
commit 2893359988
10 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ where
loop {
if self.as_mut().has_chunk() {
// This unwrap is very sad, but it can't be avoided.
let buf = self.project().chunk.as_ref().unwrap().bytes();
let buf = self.project().chunk.as_ref().unwrap().chunk();
return Poll::Ready(Ok(buf));
} else {
match self.as_mut().project().inner.poll_next(cx) {
+3 -3
View File
@@ -113,7 +113,7 @@ mod util {
}
let n = {
let dst = buf.bytes_mut();
let dst = buf.chunk_mut();
let dst = unsafe { &mut *(dst as *mut _ as *mut [MaybeUninit<u8>]) };
let mut buf = ReadBuf::uninit(dst);
let ptr = buf.filled().as_ptr();
@@ -187,10 +187,10 @@ mod util {
let n = if io.is_write_vectored() {
let mut slices = [IoSlice::new(&[]); MAX_BUFS];
let cnt = buf.bytes_vectored(&mut slices);
let cnt = buf.chunks_vectored(&mut slices);
ready!(io.poll_write_vectored(cx, &slices[..cnt]))?
} else {
ready!(io.poll_write(cx, buf.bytes()))?
ready!(io.poll_write(cx, buf.chunk()))?
};
buf.advance(n);
+1 -1
View File
@@ -76,7 +76,7 @@ impl<C: Decoder + Unpin> Stream for UdpFramed<C> {
let addr = unsafe {
// Convert `&mut [MaybeUnit<u8>]` to `&mut [u8]` because we will be
// writing to it via `poll_recv_from` and therefore initializing the memory.
let buf = &mut *(pin.rd.bytes_mut() as *mut _ as *mut [MaybeUninit<u8>]);
let buf = &mut *(pin.rd.chunk_mut() as *mut _ as *mut [MaybeUninit<u8>]);
let mut read = ReadBuf::uninit(buf);
let ptr = read.filled().as_ptr();
let res = ready!(Pin::new(&mut pin.socket).poll_recv_from(cx, &mut read));