fix: use once_cell crate until OnceLock stabilized (closes #890)

* Fixes #890 that was using OnceLock, which is nightly only, by adding the once_cell crate as a dependency.

* Make `cargo fmt` happy
This commit is contained in:
OvermindDL1 2023-04-18 14:31:04 -06:00 committed by GitHub
parent 8198cd0b68
commit 72d6af9c84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View File

@ -19,4 +19,5 @@ leptos_integration_utils = { workspace = true }
serde_json = "1"
tokio = { version = "1", features = ["full"] }
parking_lot = "0.12.1"
tokio-util = {version = "0.7.7", features = ["rt"] }
tokio-util = {version = "0.7.7", features = ["rt"] }
once_cell = "1.17"

View File

@ -31,13 +31,9 @@ use leptos::{
use leptos_integration_utils::{build_async_response, html_parts_separated};
use leptos_meta::{generate_head_metadata_separated, MetaContext};
use leptos_router::*;
use once_cell::sync::OnceCell;
use parking_lot::RwLock;
use std::{
io,
pin::Pin,
sync::{Arc, OnceLock},
thread::available_parallelism,
};
use std::{io, pin::Pin, sync::Arc, thread::available_parallelism};
use tokio::task::LocalSet;
use tokio_util::task::LocalPoolHandle;
@ -1193,7 +1189,7 @@ impl LeptosRoutes for axum::Router {
}
fn get_leptos_pool() -> LocalPoolHandle {
static LOCAL_POOL: OnceLock<LocalPoolHandle> = OnceLock::new();
static LOCAL_POOL: OnceCell<LocalPoolHandle> = OnceCell::new();
LOCAL_POOL
.get_or_init(|| {
tokio_util::task::LocalPoolHandle::new(