inc_complete/
cell.rs

1use std::{collections::HashSet, sync::Arc};
2
3#[derive(
4    Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize,
5)]
6#[serde(transparent)]
7pub struct Cell(u32);
8
9impl Cell {
10    pub(crate) fn new(index: u32) -> Self {
11        Self(index)
12    }
13}
14
15pub(crate) struct CellData {
16    pub(crate) computation_id: u32,
17    pub(crate) last_updated_version: u32,
18    pub(crate) last_verified_version: u32,
19    pub(crate) dependencies: Vec<Cell>,
20    pub(crate) input_dependencies: HashSet<Cell, rustc_hash::FxBuildHasher>,
21    pub(crate) lock: Arc<parking_lot::Mutex<()>>,
22}
23
24impl CellData {
25    pub(crate) fn new(computation_id: u32) -> Self {
26        Self {
27            computation_id,
28            last_updated_version: 0,
29            last_verified_version: 0,
30            dependencies: Vec::new(),
31            input_dependencies: Default::default(),
32            lock: Arc::new(parking_lot::Mutex::new(())),
33        }
34    }
35}