diff --git a/rust/driver-ipc/Cargo.toml b/rust/driver-ipc/Cargo.toml index 250a5e7..37872be 100644 --- a/rust/driver-ipc/Cargo.toml +++ b/rust/driver-ipc/Cargo.toml @@ -2,6 +2,7 @@ name = "driver-ipc" version = "0.1.0" edition = "2021" +rust-version = "1.80" [dependencies] log = "0.4.22" diff --git a/rust/driver-ipc/src/lib.rs b/rust/driver-ipc/src/lib.rs index 1626463..2a5e2df 100644 --- a/rust/driver-ipc/src/lib.rs +++ b/rust/driver-ipc/src/lib.rs @@ -2,7 +2,6 @@ mod client; mod core; mod driver_client; pub mod sync; -mod utils; pub use client::Client; pub use core::*; diff --git a/rust/driver-ipc/src/sync.rs b/rust/driver-ipc/src/sync.rs index 502b286..44ae350 100644 --- a/rust/driver-ipc/src/sync.rs +++ b/rust/driver-ipc/src/sync.rs @@ -1,13 +1,13 @@ mod client; mod driver_client; +use std::sync::LazyLock; + pub use client::{Client, EventsSubscription}; pub use driver_client::DriverClient; use tokio::runtime::{Builder, Runtime}; -use crate::utils::LazyLock; - static RUNTIME: LazyLock = LazyLock::new(|| { Builder::new_multi_thread() .worker_threads(1) diff --git a/rust/driver-ipc/src/utils.rs b/rust/driver-ipc/src/utils.rs deleted file mode 100644 index e9d108e..0000000 --- a/rust/driver-ipc/src/utils.rs +++ /dev/null @@ -1,21 +0,0 @@ -pub struct LazyLock T> { - data: ::std::sync::OnceLock, - f: F, -} - -impl LazyLock { - pub const fn new(f: F) -> LazyLock { - Self { - data: ::std::sync::OnceLock::new(), - f, - } - } -} - -impl ::std::ops::Deref for LazyLock { - type Target = T; - - fn deref(&self) -> &Self::Target { - self.data.get_or_init(self.f) - } -} diff --git a/rust/rust-toolchain.toml b/rust/rust-toolchain.toml index 7dc9aaf..f902363 100644 --- a/rust/rust-toolchain.toml +++ b/rust/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2024-07-05" +channel = "nightly-2024-07-26" components = ["rustfmt", "clippy"] targets = [] profile = "minimal" diff --git a/rust/virtual-display-driver/src/helpers.rs b/rust/virtual-display-driver/src/helpers.rs index 59be580..dd5e114 100644 --- a/rust/virtual-display-driver/src/helpers.rs +++ b/rust/virtual-display-driver/src/helpers.rs @@ -36,26 +36,3 @@ macro_rules! debug { } }; } - -// just a dependency-less lazy lock replacement until std stabilizes theirs -pub struct LazyLock T> { - data: ::std::sync::OnceLock, - f: F, -} - -impl LazyLock { - pub const fn new(f: F) -> LazyLock { - Self { - data: ::std::sync::OnceLock::new(), - f, - } - } -} - -impl ::std::ops::Deref for LazyLock { - type Target = T; - - fn deref(&self) -> &Self::Target { - self.data.get_or_init(self.f) - } -} diff --git a/rust/virtual-display-driver/src/ipc.rs b/rust/virtual-display-driver/src/ipc.rs index 05c3931..a7116c8 100644 --- a/rust/virtual-display-driver/src/ipc.rs +++ b/rust/virtual-display-driver/src/ipc.rs @@ -1,7 +1,7 @@ use std::{ mem::size_of, ptr::{addr_of_mut, NonNull}, - sync::{Mutex, OnceLock}, + sync::{LazyLock, Mutex, OnceLock}, thread, }; @@ -26,7 +26,7 @@ use windows::Win32::{ System::SystemServices::SECURITY_DESCRIPTOR_REVISION1, }; -use crate::{context::DeviceContext, helpers::LazyLock}; +use crate::context::DeviceContext; pub static ADAPTER: OnceLock = OnceLock::new(); pub static MONITOR_MODES: LazyLock>> =