summaryrefslogtreecommitdiff
path: root/core/examples/http_bench_json_ops.rs
diff options
context:
space:
mode:
authorLeo K <crowlkats@toaxl.com>2021-10-05 22:38:27 +0200
committerGitHub <noreply@github.com>2021-10-05 22:38:27 +0200
commit77a00ce1fb4ae2523e22b9b84ae09a0200502e38 (patch)
tree0027a2ff3dbff1e2b0c3afa7ce0f0e54805c7d62 /core/examples/http_bench_json_ops.rs
parentd67e85850688117e116bbf7054e80f30fe07afe6 (diff)
chore: various op cleanup (#12329)
Diffstat (limited to 'core/examples/http_bench_json_ops.rs')
-rw-r--r--core/examples/http_bench_json_ops.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/core/examples/http_bench_json_ops.rs b/core/examples/http_bench_json_ops.rs
index d273c2c88..5989a472f 100644
--- a/core/examples/http_bench_json_ops.rs
+++ b/core/examples/http_bench_json_ops.rs
@@ -1,5 +1,4 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
-use deno_core::error::null_opbuf;
use deno_core::error::AnyError;
use deno_core::AsyncRefCell;
use deno_core::CancelHandle;
@@ -121,7 +120,7 @@ fn create_js_runtime() -> JsRuntime {
fn op_listen(
state: &mut OpState,
- _args: (),
+ _: (),
_: (),
) -> Result<ResourceId, AnyError> {
log::debug!("listen");
@@ -158,9 +157,8 @@ async fn op_accept(
async fn op_read(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- buf: Option<ZeroCopyBuf>,
+ mut buf: ZeroCopyBuf,
) -> Result<usize, AnyError> {
- let mut buf = buf.ok_or_else(null_opbuf)?;
log::debug!("read rid={}", rid);
let stream = state.borrow().resource_table.get::<TcpStream>(rid)?;
@@ -171,9 +169,8 @@ async fn op_read(
async fn op_write(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
- buf: Option<ZeroCopyBuf>,
+ buf: ZeroCopyBuf,
) -> Result<usize, AnyError> {
- let buf = buf.ok_or_else(null_opbuf)?;
log::debug!("write rid={}", rid);
let stream = state.borrow().resource_table.get::<TcpStream>(rid)?;