Change Part::stream to reqwest::r#async::Chunk

This commit is contained in:
Bas De Bue
2019-08-05 14:50:42 +02:00
committed by Sean McArthur
parent 8027a2894a
commit 81e0f1ff2a
3 changed files with 41 additions and 10 deletions

View File

@@ -165,6 +165,7 @@ impl Chunk {
}
}
}
impl Buf for Chunk {
fn bytes(&self) -> &[u8] {
self.inner.bytes()
@@ -210,10 +211,40 @@ impl IntoIterator for Chunk {
}
}
impl From<Vec<u8>> for Chunk {
fn from(v: Vec<u8>) -> Chunk {
Chunk { inner: v.into() }
}
}
impl From<&'static [u8]> for Chunk {
fn from(slice: &'static [u8]) -> Chunk {
Chunk { inner: slice.into() }
}
}
impl From<String> for Chunk {
fn from(s: String) -> Chunk {
Chunk { inner: s.into() }
}
}
impl From<&'static str> for Chunk {
fn from(slice: &'static str) -> Chunk {
Chunk { inner: slice.into() }
}
}
impl From<Bytes> for Chunk {
fn from(bytes: Bytes) -> Chunk {
Chunk { inner: bytes.into() }
}
}
impl From<Chunk> for hyper::Chunk {
fn from(val: Chunk) -> hyper::Chunk {
val.inner
}
fn from(val: Chunk) -> hyper::Chunk {
val.inner
}
}
impl fmt::Debug for Body {