diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-03-09 08:10:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-09 12:10:54 +0000 |
commit | c3cba7f22c49ca3a3f58df44d8ea4c85d8510bff (patch) | |
tree | c710275a5c51b8a4c8175a3ebe92c928272bf3dc /ext/cache/lib.rs | |
parent | 521cb4ca9b9b02f7ba3150338d5f3c4b035aab8d (diff) |
refactor(core): Extension::builder_with_deps (#18093)
Prerequisite for https://github.com/denoland/deno/pull/18080
Diffstat (limited to 'ext/cache/lib.rs')
-rw-r--r-- | ext/cache/lib.rs | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/ext/cache/lib.rs b/ext/cache/lib.rs index 463ade94f..477bbcb3e 100644 --- a/ext/cache/lib.rs +++ b/ext/cache/lib.rs @@ -25,23 +25,25 @@ pub struct CreateCache<C: Cache + 'static>(pub Arc<dyn Fn() -> C>); pub fn init<CA: Cache + 'static>( maybe_create_cache: Option<CreateCache<CA>>, ) -> Extension { - Extension::builder(env!("CARGO_PKG_NAME")) - .dependencies(vec!["deno_webidl", "deno_web", "deno_url", "deno_fetch"]) - .esm(include_js_files!("01_cache.js",)) - .ops(vec![ - op_cache_storage_open::decl::<CA>(), - op_cache_storage_has::decl::<CA>(), - op_cache_storage_delete::decl::<CA>(), - op_cache_put::decl::<CA>(), - op_cache_match::decl::<CA>(), - op_cache_delete::decl::<CA>(), - ]) - .state(move |state| { - if let Some(create_cache) = maybe_create_cache.clone() { - state.put(create_cache); - } - }) - .build() + Extension::builder_with_deps( + env!("CARGO_PKG_NAME"), + &["deno_webidl", "deno_web", "deno_url", "deno_fetch"], + ) + .esm(include_js_files!("01_cache.js",)) + .ops(vec![ + op_cache_storage_open::decl::<CA>(), + op_cache_storage_has::decl::<CA>(), + op_cache_storage_delete::decl::<CA>(), + op_cache_put::decl::<CA>(), + op_cache_match::decl::<CA>(), + op_cache_delete::decl::<CA>(), + ]) + .state(move |state| { + if let Some(create_cache) = maybe_create_cache.clone() { + state.put(create_cache); + } + }) + .build() } pub fn get_declaration() -> PathBuf { |