From 03019e778189b38938f1238f22652162de5a7434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 21 Apr 2022 02:22:55 +0200 Subject: Revert various PRs related to "ext/http" (#14339) * Revert "feat(ext/http): stream auto resp body compression (#14325)" * Revert "core: introduce `resource.read_return` (#14331)" * Revert "perf(http): optimize `ReadableStream`s backed by a resource (#14284)" --- core/examples/http_bench_json_ops.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'core/examples') diff --git a/core/examples/http_bench_json_ops.rs b/core/examples/http_bench_json_ops.rs index 7c895f326..2068c3b85 100644 --- a/core/examples/http_bench_json_ops.rs +++ b/core/examples/http_bench_json_ops.rs @@ -83,18 +83,13 @@ struct TcpStream { } impl TcpStream { - async fn read( - self: Rc, - mut buf: ZeroCopyBuf, - ) -> Result<(usize, ZeroCopyBuf), Error> { + async fn read(self: Rc, mut buf: ZeroCopyBuf) -> Result { let mut rd = RcRef::map(&self, |r| &r.rd).borrow_mut().await; let cancel = RcRef::map(self, |r| &r.cancel); - let nread = rd - .read(&mut buf) + rd.read(&mut buf) .try_or_cancel(cancel) .await - .map_err(Error::from)?; - Ok((nread, buf)) + .map_err(Error::from) } async fn write(self: Rc, buf: ZeroCopyBuf) -> Result { @@ -104,10 +99,7 @@ impl TcpStream { } impl Resource for TcpStream { - fn read_return( - self: Rc, - buf: ZeroCopyBuf, - ) -> AsyncResult<(usize, ZeroCopyBuf)> { + fn read(self: Rc, buf: ZeroCopyBuf) -> AsyncResult { Box::pin(self.read(buf)) } -- cgit v1.2.3