summaryrefslogtreecommitdiff
path: root/ext/webstorage/lib.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-03-17 16:15:27 -0600
committerGitHub <noreply@github.com>2023-03-17 22:15:27 +0000
commit3487fde236d0852a8b0672c293fa41a741f471e8 (patch)
treeaf466368147a08b787080446319a3a46a60ee37d /ext/webstorage/lib.rs
parente55b448730160a6e4df9815a268d4049ac89deab (diff)
perf(core) Reduce copying and cloning in extension initialization (#18252)
Follow-up to #18210: * we are passing the generated `cfg` object into the state function rather than passing individual config fields * reduce cloning dramatically by making the state_fn `FnOnce` * `take` for `ExtensionBuilder` to avoid more unnecessary copies * renamed `config` to `options`
Diffstat (limited to 'ext/webstorage/lib.rs')
-rw-r--r--ext/webstorage/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/webstorage/lib.rs b/ext/webstorage/lib.rs
index 6cdc7bbff..10be072e8 100644
--- a/ext/webstorage/lib.rs
+++ b/ext/webstorage/lib.rs
@@ -31,11 +31,11 @@ deno_core::extension!(deno_webstorage,
op_webstorage_iterate_keys,
],
esm = [ "01_webstorage.js" ],
- config = {
+ options = {
origin_storage_dir: Option<PathBuf>
},
- state = |state, origin_storage_dir| {
- if let Some(origin_storage_dir) = origin_storage_dir {
+ state = |state, options| {
+ if let Some(origin_storage_dir) = options.origin_storage_dir {
state.put(OriginStorageDir(origin_storage_dir));
}
},