summaryrefslogtreecommitdiff
path: root/core/examples/http_bench_json_ops.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-04-21 02:22:55 +0200
committerGitHub <noreply@github.com>2022-04-21 02:22:55 +0200
commit03019e778189b38938f1238f22652162de5a7434 (patch)
treecf16b44be07c1c488ffe4f31fe77eab7f6bd8c95 /core/examples/http_bench_json_ops.rs
parentaaaa877d91c5f8b88722fd1ec725791b0eb4efe0 (diff)
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)"
Diffstat (limited to 'core/examples/http_bench_json_ops.rs')
-rw-r--r--core/examples/http_bench_json_ops.rs16
1 files changed, 4 insertions, 12 deletions
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<Self>,
- mut buf: ZeroCopyBuf,
- ) -> Result<(usize, ZeroCopyBuf), Error> {
+ async fn read(self: Rc<Self>, mut buf: ZeroCopyBuf) -> Result<usize, Error> {
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<Self>, buf: ZeroCopyBuf) -> Result<usize, Error> {
@@ -104,10 +99,7 @@ impl TcpStream {
}
impl Resource for TcpStream {
- fn read_return(
- self: Rc<Self>,
- buf: ZeroCopyBuf,
- ) -> AsyncResult<(usize, ZeroCopyBuf)> {
+ fn read(self: Rc<Self>, buf: ZeroCopyBuf) -> AsyncResult<usize> {
Box::pin(self.read(buf))
}