summaryrefslogtreecommitdiff
path: root/ext/http/http_next.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-06-24 13:54:10 +0200
committerGitHub <noreply@github.com>2023-06-24 13:54:10 +0200
commit65d9bfb53361bfce6dc594c6a9df92c017dea6cb (patch)
tree63886c7225b52444165be3abd53c4e745ca77512 /ext/http/http_next.rs
parent8d6dbda90ec0593f3f6e10c6696e320bdff7daa9 (diff)
refactor(ops): Adding op2 macro and implementing in a couple of places (#19534)
This is a new op system that will eventually replace `#[op]`. Features - More maintainable, generally less-coupled code - More modern Rust proc-macro libraries - Enforces correct `fast` labelling for fast ops, allowing for visual scanning of fast ops - Explicit marking of `#[string]`, `#[serde]` and `#[smi]` parameters. This first version of op2 supports integer and Option<integer> parameters only, and allows us to start working on converting ops and adding features.
Diffstat (limited to 'ext/http/http_next.rs')
-rw-r--r--ext/http/http_next.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs
index 89506b47d..92afe1456 100644
--- a/ext/http/http_next.rs
+++ b/ext/http/http_next.rs
@@ -20,6 +20,7 @@ use cache_control::CacheControl;
use deno_core::error::AnyError;
use deno_core::futures::TryFutureExt;
use deno_core::op;
+use deno_core::op2;
use deno_core::serde_v8;
use deno_core::serde_v8::from_v8;
use deno_core::task::spawn;
@@ -208,8 +209,8 @@ pub async fn op_http_upgrade_websocket_next(
ws_create_server_stream(&mut state.borrow_mut(), stream, bytes)
}
-#[op(fast)]
-pub fn op_http_set_promise_complete(slab_id: SlabId, status: u16) {
+#[op2(fast)]
+pub fn op_http_set_promise_complete(#[smi] slab_id: SlabId, status: u16) {
let mut http = slab_get(slab_id);
// The Javascript code will never provide a status that is invalid here (see 23_response.js)
*http.response().status_mut() = StatusCode::from_u16(status).unwrap();