diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-04-29 00:16:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 18:16:45 -0400 |
commit | e89295b176b4f494d19b547b6b4d7c98d0cf1da1 (patch) | |
tree | ae2f043d8a883b6f6f754c057b8dfe678b3c7944 /op_crates/crypto/lib.rs | |
parent | e63c53315450ed305752566f4c3ad2bb76c8b8a3 (diff) |
refactor(extensions): reintroduce builder (#10412)
Diffstat (limited to 'op_crates/crypto/lib.rs')
-rw-r--r-- | op_crates/crypto/lib.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/op_crates/crypto/lib.rs b/op_crates/crypto/lib.rs index d5b0a30bc..543220548 100644 --- a/op_crates/crypto/lib.rs +++ b/op_crates/crypto/lib.rs @@ -16,22 +16,22 @@ use std::path::PathBuf; pub use rand; // Re-export rand pub fn init(maybe_seed: Option<u64>) -> Extension { - Extension::with_ops( - include_js_files!( + Extension::builder() + .js(include_js_files!( prefix "deno:op_crates/crypto", "01_crypto.js", - ), - vec![( + )) + .ops(vec![( "op_crypto_get_random_values", op_sync(op_crypto_get_random_values), - )], - Some(Box::new(move |state| { + )]) + .state(move |state| { if let Some(seed) = maybe_seed { state.put(StdRng::seed_from_u64(seed)); } Ok(()) - })), - ) + }) + .build() } pub fn op_crypto_get_random_values( |