Skip to content

Commit b4a5543

Browse files
committed
Use LazyLock instead of deprecate Lazy
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 8add223 commit b4a5543

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/hyperlight-js-runtime/src/main/hyperlight.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl hyperlight_js_runtime::host::Host for Host {
6262
}
6363
}
6464

65-
static RUNTIME: spin::Lazy<Mutex<JsRuntime>> = spin::Lazy::new(|| {
65+
static RUNTIME: spin::LazyLock<Mutex<JsRuntime>> = spin::LazyLock::new(|| {
6666
Mutex::new(JsRuntime::new(Host).unwrap_or_else(|e| {
6767
panic!("Failed to initialize JS runtime: {e:#?}");
6868
}))
@@ -72,7 +72,7 @@ static RUNTIME: spin::Lazy<Mutex<JsRuntime>> = spin::Lazy::new(|| {
7272
#[instrument(skip_all, level = "info")]
7373
fn main() {
7474
// dereference RUNTIME to force its initialization
75-
// of the Lazy static
75+
// of the LazyLock static
7676
let _ = &*RUNTIME;
7777
}
7878

src/hyperlight-js-runtime/src/modules/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use hashbrown::HashMap;
1919
use rquickjs::loader::{Loader, Resolver};
2020
use rquickjs::module::ModuleDef;
2121
use rquickjs::{Ctx, Module, Result};
22-
use spin::Lazy;
22+
use spin::LazyLock;
2323

2424
pub mod console;
2525
pub mod crypto;
@@ -47,7 +47,7 @@ fn declaration<M: ModuleDef>() -> ModuleDeclarationFn {
4747
declare::<M>
4848
}
4949

50-
static NATIVE_MODULES: Lazy<HashMap<&str, ModuleDeclarationFn>> = Lazy::new(|| {
50+
static NATIVE_MODULES: LazyLock<HashMap<&str, ModuleDeclarationFn>> = LazyLock::new(|| {
5151
HashMap::from([
5252
("io", declaration::<io::js_io>()),
5353
("crypto", declaration::<crypto::js_crypto>()),

0 commit comments

Comments
 (0)