From 89e1ee14290b46dfda1e105cb40ef5c044c940d7 Mon Sep 17 00:00:00 2001 From: decentclock Date: Mon, 20 Jun 2022 09:27:48 -0600 Subject: [PATCH] Rename SyncLazy to LazyLock --- broker/src/mqtt.rs | 4 ++-- sphinx-key/src/periph/led.rs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/broker/src/mqtt.rs b/broker/src/mqtt.rs index c99ea97..5c84bea 100644 --- a/broker/src/mqtt.rs +++ b/broker/src/mqtt.rs @@ -8,7 +8,7 @@ use librumqttd::{ use std::sync::Arc; use std::thread; use std::time::Duration; -use std::{lazy::SyncLazy, sync::Mutex}; +use std::sync::{LazyLock, Mutex}; use tokio::sync::mpsc; use tokio::time::timeout; @@ -19,7 +19,7 @@ const PASSWORD: &str = "sphinx-key-pass"; // must get a reply within this time, or disconnects const REPLY_TIMEOUT_MS: u64 = 10000; -static CONNECTED: SyncLazy> = SyncLazy::new(|| Mutex::new(false)); +static CONNECTED: LazyLock> = LazyLock::new(|| Mutex::new(false)); fn set_connected(b: bool) { *CONNECTED.lock().unwrap() = b; } diff --git a/sphinx-key/src/periph/led.rs b/sphinx-key/src/periph/led.rs index c6bb927..b6ca157 100644 --- a/sphinx-key/src/periph/led.rs +++ b/sphinx-key/src/periph/led.rs @@ -6,10 +6,9 @@ use esp_idf_hal::peripherals::Peripherals; use esp_idf_hal::rmt::config::TransmitConfig; use esp_idf_hal::rmt::{FixedLengthSignal, PinState, Pulse, Transmit}; -use std::lazy::SyncLazy; -use std::sync::Mutex; +use std::sync::{LazyLock, Mutex}; -static TX: SyncLazy, esp_idf_hal::rmt::CHANNEL0>>> = SyncLazy::new(|| { +static TX: LazyLock, esp_idf_hal::rmt::CHANNEL0>>> = LazyLock::new(|| { let peripherals = Peripherals::take().unwrap(); let led = peripherals.pins.gpio8.into_output().unwrap(); let channel = peripherals.rmt.channel0;