aboutsummaryrefslogtreecommitdiff
path: root/incria
diff options
context:
space:
mode:
authortcmal <tcmal>2023-06-04 19:55:02 +0000
committerAria <me@aria.rip>2023-10-01 17:31:29 +0100
commit4157af997947a3e3354554ad82d449be38af8f40 (patch)
tree21493b3b43c3da590bec55fd7ba0c70adabd2d63 /incria
parent2c1525849f3e47587f58c7afbd3020c8076c9f4e (diff)
use std oncelock
Diffstat (limited to 'incria')
-rw-r--r--incria/Cargo.lock7
-rw-r--r--incria/Cargo.toml1
-rw-r--r--incria/examples/spreadsheet.rs5
-rw-r--r--incria/src/deps.rs6
4 files changed, 4 insertions, 15 deletions
diff --git a/incria/Cargo.lock b/incria/Cargo.lock
index fa39449..32dc3f1 100644
--- a/incria/Cargo.lock
+++ b/incria/Cargo.lock
@@ -21,7 +21,6 @@ dependencies = [
name = "incria"
version = "0.1.0"
dependencies = [
- "once_cell",
"tokio",
]
@@ -42,12 +41,6 @@ dependencies = [
]
[[package]]
-name = "once_cell"
-version = "1.17.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
-
-[[package]]
name = "pin-project-lite"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/incria/Cargo.toml b/incria/Cargo.toml
index 1ff3824..608c926 100644
--- a/incria/Cargo.toml
+++ b/incria/Cargo.toml
@@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021"
[dependencies]
-once_cell = "1.17.1"
tokio = { version = "1.28.1", features = ["sync", "rt"] }
[dev-dependencies]
diff --git a/incria/examples/spreadsheet.rs b/incria/examples/spreadsheet.rs
index 135ca80..5c377e3 100644
--- a/incria/examples/spreadsheet.rs
+++ b/incria/examples/spreadsheet.rs
@@ -1,11 +1,10 @@
-use std::{future::Future, pin::Pin};
+use std::{future::Future, pin::Pin, sync::OnceLock};
use incria::{
deps,
thunk::{Thunk, ThunkMapper},
Mapper,
};
-use once_cell::sync::OnceCell;
type Key = (usize, usize);
type Value = usize;
@@ -29,7 +28,7 @@ impl Thunk<Key, Value> for CellThunk {
}
type CellMapping = ThunkMapper<Key, Value, CellThunk>;
-static CELL_MAPPING: OnceCell<CellMapping> = OnceCell::new();
+static CELL_MAPPING: OnceLock<CellMapping> = OnceLock::new();
fn cell_mapping() -> &'static CellMapping {
CELL_MAPPING.get_or_init(CellMapping::default)
}
diff --git a/incria/src/deps.rs b/incria/src/deps.rs
index d72e684..acc39f1 100644
--- a/incria/src/deps.rs
+++ b/incria/src/deps.rs
@@ -13,11 +13,9 @@ use std::{
collections::{HashMap, VecDeque},
fmt::Write,
future::Future,
- sync::Mutex,
+ sync::{Mutex, OnceLock},
};
-use once_cell::sync::OnceCell;
-
/// Identifier of a node, unique across a program run.
pub type NodeId = usize;
@@ -112,7 +110,7 @@ struct NodeInfo {
}
/// The global instance of the dependency tracker
-static DEP_TRACKER: OnceCell<DepTracker> = OnceCell::new();
+static DEP_TRACKER: OnceLock<DepTracker> = OnceLock::new();
fn dep_tracker() -> &'static DepTracker {
DEP_TRACKER.get_or_init(DepTracker::default)
}