Sync Response::text() & Response::json() call their async version

This commit is contained in:
messense
2019-06-23 16:30:07 +08:00
committed by Sean McArthur
parent c5f2bf6c32
commit 1e7c9fe507
3 changed files with 33 additions and 74 deletions

View File

@@ -142,14 +142,6 @@ impl Decoder {
Decoder::plain_text(body)
}
}
pub(crate) fn content_length(&self) -> Option<u64> {
match self.inner {
Inner::PlainText(ref body) => body.content_length(),
_ => None,
}
}
}
impl Stream for Decoder {

View File

@@ -271,7 +271,7 @@ impl<T: Into<Body>> From<http::Response<T>> for Response {
}
/// A JSON object.
pub struct Json<T> {
struct Json<T> {
concat: Concat2<Decoder>,
_marker: PhantomData<T>,
}
@@ -294,7 +294,7 @@ impl<T> fmt::Debug for Json<T> {
}
#[derive(Debug)]
pub struct Text {
struct Text {
concat: Concat2<Decoder>,
encoding: &'static Encoding,
}