diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-06-24 13:54:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-24 13:54:10 +0200 |
commit | 65d9bfb53361bfce6dc594c6a9df92c017dea6cb (patch) | |
tree | 63886c7225b52444165be3abd53c4e745ca77512 /core/ops_builtin.rs | |
parent | 8d6dbda90ec0593f3f6e10c6696e320bdff7daa9 (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 'core/ops_builtin.rs')
-rw-r--r-- | core/ops_builtin.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/ops_builtin.rs b/core/ops_builtin.rs index 2334c6918..20afa210b 100644 --- a/core/ops_builtin.rs +++ b/core/ops_builtin.rs @@ -11,6 +11,7 @@ use crate::OpState; use crate::Resource; use anyhow::Error; use deno_ops::op; +use deno_ops::op2; use serde_v8::ToJsBuffer; use std::cell::RefCell; use std::io::stderr; @@ -95,7 +96,7 @@ pub fn op_resources(state: &mut OpState) -> Vec<(ResourceId, String)> { .collect() } -#[op(fast)] +#[op2(core, fast)] fn op_add(a: i32, b: i32) -> i32 { a + b } |