pub struct PromiseDependencyGraph { /* private fields */ }
Expand description
Tracks dependencies between promises for topological sorting
Implementations§
Source§impl PromiseDependencyGraph
impl PromiseDependencyGraph
pub fn new() -> Self
Sourcepub fn add_dependency(&mut self, promise: PromiseId, depends_on: PromiseId)
pub fn add_dependency(&mut self, promise: PromiseId, depends_on: PromiseId)
Add a dependency: promise
depends on depends_on
Sourcepub fn dependencies_of(
&self,
promise: &PromiseId,
) -> Option<&HashSet<PromiseId>>
pub fn dependencies_of( &self, promise: &PromiseId, ) -> Option<&HashSet<PromiseId>>
Get all direct dependencies of a promise
Sourcepub fn dependents_of(&self, promise: &PromiseId) -> Option<&HashSet<PromiseId>>
pub fn dependents_of(&self, promise: &PromiseId) -> Option<&HashSet<PromiseId>>
Get all promises that depend on this one
Sourcepub fn topological_sort(&self) -> Option<Vec<PromiseId>>
pub fn topological_sort(&self) -> Option<Vec<PromiseId>>
Perform topological sort to get execution order Returns None if there’s a cycle
Sourcepub fn would_create_cycle(
&self,
promise: PromiseId,
depends_on: PromiseId,
) -> bool
pub fn would_create_cycle( &self, promise: PromiseId, depends_on: PromiseId, ) -> bool
Check if adding a dependency would create a cycle
Trait Implementations§
Source§impl Debug for PromiseDependencyGraph
impl Debug for PromiseDependencyGraph
Source§impl Default for PromiseDependencyGraph
impl Default for PromiseDependencyGraph
Source§fn default() -> PromiseDependencyGraph
fn default() -> PromiseDependencyGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PromiseDependencyGraph
impl RefUnwindSafe for PromiseDependencyGraph
impl Send for PromiseDependencyGraph
impl Sync for PromiseDependencyGraph
impl Unpin for PromiseDependencyGraph
impl UnwindSafe for PromiseDependencyGraph
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