pub struct GraphBuilder { /* private fields */ }Expand description
Intermediate builder state used during graph construction.
Implementations§
Source§impl GraphBuilder
impl GraphBuilder
Sourcepub fn get_or_create_node(&mut self, canonical_path: &str) -> ModuleId
pub fn get_or_create_node(&mut self, canonical_path: &str) -> ModuleId
Allocate a new node with the given canonical path and return its id. If a node with this path already exists, returns its existing id.
Sourcepub fn begin_visit(&mut self, canonical_path: &str) -> bool
pub fn begin_visit(&mut self, canonical_path: &str) -> bool
Mark a module as currently being visited (for cycle detection).
Returns false if the module is already being visited (cycle!).
Sourcepub fn is_visited(&self, canonical_path: &str) -> bool
pub fn is_visited(&self, canonical_path: &str) -> bool
Check if a module has been fully visited.
Sourcepub fn is_visiting(&self, canonical_path: &str) -> bool
pub fn is_visiting(&self, canonical_path: &str) -> bool
Check if a module is currently being visited (would form a cycle).
Sourcepub fn get_cycle_path(&self, target: &str) -> Vec<String>
pub fn get_cycle_path(&self, target: &str) -> Vec<String>
Get the cycle path when a cycle is detected.
Sourcepub fn compute_topo_order(&self, root_id: ModuleId) -> Vec<ModuleId>
pub fn compute_topo_order(&self, root_id: ModuleId) -> Vec<ModuleId>
Compute topological order via DFS post-order. The root module is excluded from the topo order (compiled separately).
Sourcepub fn build(self, root_id: ModuleId) -> ModuleGraph
pub fn build(self, root_id: ModuleId) -> ModuleGraph
Finalize into a ModuleGraph.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GraphBuilder
impl RefUnwindSafe for GraphBuilder
impl Send for GraphBuilder
impl Sync for GraphBuilder
impl Unpin for GraphBuilder
impl UnsafeUnpin for GraphBuilder
impl UnwindSafe for GraphBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more