feat(lib): update bytes to 0.6, update http-body (#2339)
This branch updates `bytes` and `http-body` to the latest versions. The `http-body` version that uses `bytes` 0.6 hasn't been released yet, so we depend on it via a git dep for now. Presumably Hyper and `http-body` will synchronize their releases. Other than that, this is a pretty mechanical update. Should fix the build and unblock the `h2` update to use vectored writes.
This commit is contained in:
@@ -22,12 +22,12 @@ include = [
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
bytes = "0.5"
|
||||
bytes = "0.6"
|
||||
futures-core = { version = "0.3", default-features = false }
|
||||
futures-channel = "0.3"
|
||||
futures-util = { version = "0.3", default-features = false }
|
||||
http = "0.2"
|
||||
http-body = "0.3.1"
|
||||
http-body = { git = "https://github.com/hyperium/http-body" }
|
||||
httpdate = "0.3"
|
||||
httparse = "1.0"
|
||||
h2 = { git = "https://github.com/hyperium/h2", optional = true }
|
||||
@@ -63,7 +63,7 @@ tokio = { version = "0.3", features = [
|
||||
"test-util",
|
||||
] }
|
||||
tokio-test = "0.3"
|
||||
tokio-util = { version = "0.4", features = ["codec"] }
|
||||
tokio-util = { version = "0.5", features = ["codec"] }
|
||||
tower-util = "0.3"
|
||||
url = "1.0"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
use bytes::buf::BufExt as _;
|
||||
use bytes::Buf as _;
|
||||
use hyper::Client;
|
||||
|
||||
// A simple type alias so as to DRY.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
use bytes::buf::BufExt;
|
||||
use bytes::Buf;
|
||||
use futures_util::{stream, StreamExt};
|
||||
use hyper::client::HttpConnector;
|
||||
use hyper::service::{make_service_fn, service_fn};
|
||||
|
||||
@@ -23,7 +23,7 @@ where
|
||||
let second = if let Some(buf) = body.data().await {
|
||||
buf?
|
||||
} else {
|
||||
return Ok(first.to_bytes());
|
||||
return Ok(first.copy_to_bytes(first.bytes().len()));
|
||||
};
|
||||
|
||||
// With more than 1 buf, we gotta flatten into a Vec first.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::fmt;
|
||||
use std::io::IoSlice;
|
||||
|
||||
use bytes::buf::ext::{BufExt, Chain, Take};
|
||||
use bytes::buf::{Chain, Take};
|
||||
use bytes::Buf;
|
||||
|
||||
use super::io::WriteBuf;
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::cmp;
|
||||
use std::fmt;
|
||||
use std::io::{self, IoSlice};
|
||||
use std::marker::Unpin;
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
@@ -191,7 +192,10 @@ where
|
||||
if self.read_buf_remaining_mut() < next {
|
||||
self.read_buf.reserve(next);
|
||||
}
|
||||
let mut buf = ReadBuf::uninit(&mut self.read_buf.bytes_mut()[..]);
|
||||
|
||||
let dst = self.read_buf.bytes_mut();
|
||||
let dst = unsafe { &mut *(dst as *mut _ as *mut [MaybeUninit<u8>]) };
|
||||
let mut buf = ReadBuf::uninit(dst);
|
||||
match Pin::new(&mut self.io).poll_read(cx, &mut buf) {
|
||||
Poll::Ready(Ok(_)) => {
|
||||
let n = buf.filled().len();
|
||||
|
||||
Reference in New Issue
Block a user