Skip to content

Commit 62f6486

Browse files
committed
globals: migrate to LazyLock
std::sync::LazyLock (https://doc.rust-lang.org/beta/std/sync/struct.LazyLock.html) is now stable. We can migrate to it, instead of using external `lazy_static` dependency.
1 parent f1ed076 commit 62f6486

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scylla-rust-wrapper/src/lib.rs

Lines changed: 6 additions & 6 deletions
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)