Remove the dependency on bytes crate.

This commit is contained in:
Sunli 2020-11-30 13:43:17 +08:00
parent 84902a6679
commit 3a0dda2224
2 changed files with 3 additions and 5 deletions

View File

@ -29,7 +29,7 @@ default = [
]
apollo_tracing = ["chrono"]
apollo_persisted_queries = ["async-mutex", "lru", "sha2"]
multipart = ["bytes", "multer", "tempfile"]
multipart = ["multer", "tempfile"]
unblock = ["blocking"]
string_number = ["num-traits"]
# Used for doc(cfg())
@ -66,7 +66,6 @@ uuid = { version = "0.8.1", optional = true, features = ["v4", "serde"] }
# Non-feature optional dependencies
async-mutex = { version = "1.4.0", optional = true }
blocking = { version = "1.0.0", optional = true }
bytes = { version = "0.6.0", optional = true }
lru = { version = "0.6.0", optional = true }
multer = { version = "1.2.2", optional = true }
num-traits = { version = "0.2.12", optional = true }

View File

@ -3,7 +3,6 @@ use std::io::{self, Seek, SeekFrom, Write};
use std::pin::Pin;
use std::task::{Context, Poll};
use bytes::Bytes;
use futures_util::io::AsyncRead;
use futures_util::stream::Stream;
use multer::{Constraints, Multipart, SizeLimit};
@ -155,7 +154,7 @@ impl<T> ReaderStream<T> {
}
impl<T: AsyncRead> Stream for ReaderStream<T> {
type Item = io::Result<Bytes>;
type Item = io::Result<Vec<u8>>;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
let this = self.project();
@ -163,7 +162,7 @@ impl<T: AsyncRead> Stream for ReaderStream<T> {
Poll::Ready(
match futures_util::ready!(this.reader.poll_read(cx, this.buf)?) {
0 => None,
size => Some(Ok(Bytes::copy_from_slice(&this.buf[..size]))),
size => Some(Ok(this.buf[..size].to_vec())),
},
)
}