Skip to content

Commit 81e668e

Browse files
authored
Merge pull request #212 from muzarski/use-lazy-lock
lib: migrate to stable `LazyLock`
2 parents f1ed076 + fb85689 commit 81e668e

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

scylla-rust-wrapper/Cargo.lock

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scylla-rust-wrapper/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ scylla = { git = "https://github.com/scylladb/scylla-rust-driver.git", rev = "v0
1414
"ssl",
1515
] }
1616
tokio = { version = "1.27.0", features = ["full"] }
17-
lazy_static = "1.4.0"
1817
uuid = "1.1.2"
1918
machine-uid = "0.2.0"
2019
rand = "0.8.4"

scylla-rust-wrapper/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use crate::logging::stderr_log_callback;
44
use crate::logging::Logger;
5-
use lazy_static::lazy_static;
5+
use std::sync::LazyLock;
66
use std::sync::RwLock;
77
use tokio::runtime::Runtime;
88

@@ -110,13 +110,13 @@ pub mod cass_uuid_types {
110110
include_bindgen_generated!("cppdriver_uuid_types.rs");
111111
}
112112

113-
lazy_static! {
114-
pub static ref RUNTIME: Runtime = Runtime::new().unwrap();
115-
pub static ref LOGGER: RwLock<Logger> = RwLock::new(Logger {
113+
pub static RUNTIME: LazyLock<Runtime> = LazyLock::new(|| Runtime::new().unwrap());
114+
pub static LOGGER: LazyLock<RwLock<Logger>> = LazyLock::new(|| {
115+
RwLock::new(Logger {
116116
cb: Some(stderr_log_callback),
117117
data: std::ptr::null_mut(),
118-
});
119-
}
118+
})
119+
});
120120

121121
// To send a Rust object to C:
122122

0 commit comments

Comments
 (0)