pub struct DepGraph {
pub deps: HashMap<CellAddress, HashSet<CellAddress>>,
pub rdeps: HashMap<CellAddress, HashSet<CellAddress>>,
}Expand description
Bidirectional dependency graph between cells
Fields§
§deps: HashMap<CellAddress, HashSet<CellAddress>>cell → set of cells it directly depends on (reads from)
rdeps: HashMap<CellAddress, HashSet<CellAddress>>cell → set of cells that depend on it (readers)
Implementations§
Source§impl DepGraph
impl DepGraph
pub fn new() -> Self
Sourcepub fn set_deps(
&mut self,
cell: CellAddress,
dependencies: HashSet<CellAddress>,
)
pub fn set_deps( &mut self, cell: CellAddress, dependencies: HashSet<CellAddress>, )
Register that cell depends on all cells in dependencies
Sourcepub fn remove_cell(&mut self, cell: &CellAddress)
pub fn remove_cell(&mut self, cell: &CellAddress)
Remove all dependency information for a cell (when cell content changes to non-formula)
Sourcepub fn dirty_set(&self, changed: &CellAddress) -> Vec<CellAddress>
pub fn dirty_set(&self, changed: &CellAddress) -> Vec<CellAddress>
Compute the minimal ordered set of cells that need recalculation
when changed is modified. Returns cells in topological order.
Sourcepub fn would_create_cycle(
&self,
cell: &CellAddress,
new_dep: &CellAddress,
) -> bool
pub fn would_create_cycle( &self, cell: &CellAddress, new_dep: &CellAddress, ) -> bool
Check if adding new_dep for cell would create a circular reference
pub fn dep_count(&self) -> usize
pub fn rdep_count(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DepGraph
impl RefUnwindSafe for DepGraph
impl Send for DepGraph
impl Sync for DepGraph
impl Unpin for DepGraph
impl UnsafeUnpin for DepGraph
impl UnwindSafe for DepGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more