reduce size of Response, async::Response, and async::Decoder

This commit is contained in:
Sean McArthur
2018-09-19 15:23:01 -07:00
parent 2698148743
commit 0735e586e5
4 changed files with 85 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
use std::fmt;
use futures::{Stream, Poll, Async};
use bytes::Bytes;
use bytes::{Buf, Bytes};
use hyper::body::Payload;
/// An asynchronous `Stream`.
@@ -88,6 +88,20 @@ pub struct Chunk {
inner: ::hyper::Chunk,
}
impl Buf for Chunk {
fn bytes(&self) -> &[u8] {
self.inner.bytes()
}
fn remaining(&self) -> usize {
self.inner.remaining()
}
fn advance(&mut self, n: usize) {
self.inner.advance(n);
}
}
impl AsRef<[u8]> for Chunk {
#[inline]
fn as_ref(&self) -> &[u8] {