mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 02:52:07 +08:00
refactor(deps): replace once_cell with std OnceLock and LazyLock (#8136)
This commit is contained in:
@@ -4,7 +4,6 @@ use anyhow::Error;
|
||||
use arc_swap::{ArcSwap, ArcSwapOption};
|
||||
use backon::{ConstantBuilder, Retryable as _};
|
||||
use clash_verge_logging::{Type, logging};
|
||||
use once_cell::sync::OnceCell;
|
||||
use reqwest_dav::list_cmd::{ListEntity, ListFile, ListMultiStatus};
|
||||
use smartstring::alias::String;
|
||||
use std::{
|
||||
@@ -12,7 +11,7 @@ use std::{
|
||||
env::{consts::OS, temp_dir},
|
||||
io::Write as _,
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
sync::{Arc, OnceLock},
|
||||
time::Duration,
|
||||
};
|
||||
use tokio::{fs, time::timeout};
|
||||
@@ -58,7 +57,7 @@ pub struct WebDavClient {
|
||||
|
||||
impl WebDavClient {
|
||||
pub fn global() -> &'static Self {
|
||||
static WEBDAV_CLIENT: OnceCell<WebDavClient> = OnceCell::new();
|
||||
static WEBDAV_CLIENT: OnceLock<WebDavClient> = OnceLock::new();
|
||||
WEBDAV_CLIENT.get_or_init(|| Self {
|
||||
config: ArcSwapOption::new(None),
|
||||
clients: ArcSwap::new(Arc::new(HashMap::new())),
|
||||
|
||||
Reference in New Issue
Block a user