diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-03-14 23:14:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 18:44:15 +0100 |
commit | b4e42953e1d243f2eda20e5be6b845d60b7bf688 (patch) | |
tree | 10b3bfff165f9c04f9174c7c399d44b9b724c3b3 /ops/README.md | |
parent | 4e3ed37037a2aa1edeac260dc3463a81d9cf9b88 (diff) |
feat(core): codegen ops (#13861)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
Diffstat (limited to 'ops/README.md')
-rw-r--r-- | ops/README.md | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ops/README.md b/ops/README.md new file mode 100644 index 000000000..02ee266f7 --- /dev/null +++ b/ops/README.md @@ -0,0 +1,16 @@ +# deno_ops + +`proc_macro` for generating highly optimized V8 functions from Deno ops. + +```rust +// Declare an op. +#[op] +pub fn op_add(_: &mut OpState, a: i32, b: i32) -> Result<i32, AnyError> { + Ok(a + b) +} + +// Register with an extension. +Extension::builder() + .ops(vec![op_add::decl()]) + .build(); +``` |