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 /ops/op2/test_cases/sync/add_options.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 'ops/op2/test_cases/sync/add_options.rs')
-rw-r--r-- | ops/op2/test_cases/sync/add_options.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ops/op2/test_cases/sync/add_options.rs b/ops/op2/test_cases/sync/add_options.rs new file mode 100644 index 000000000..a5f2c8f4a --- /dev/null +++ b/ops/op2/test_cases/sync/add_options.rs @@ -0,0 +1,6 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. + +#[op2(core)] +pub fn op_test_add_option(a: u32, b: Option<u32>) -> u32 { + a + b.unwrap_or(100) +} |