pub struct ProjectGraph { /* private fields */ }Expand description
A workspace’s project-level dependency shape.
Implementations§
Source§impl ProjectGraph
impl ProjectGraph
Sourcepub fn parents_of(&self, name: &str) -> &BTreeSet<String>
pub fn parents_of(&self, name: &str) -> &BTreeSet<String>
The hosted projects name depends on, in name order. Empty for a root or an
isolated project.
Sourcepub fn inbound_edges_of(&self, name: &str) -> usize
pub fn inbound_edges_of(&self, name: &str) -> usize
How many external-ref edges point into name.
Exposed because it is what Self::busiest_hub reduces, and because it is
the number Self::children_of is most likely to be confused with: this
counts edges and includes self-references, that counts distinct dependent
projects and excludes them. A spoke referencing the hub from twenty config
keys contributes twenty here and one there.
Sourcepub fn children_of(&self, name: &str) -> usize
pub fn children_of(&self, name: &str) -> usize
How many hosted projects depend on name.
A lookup rather than a scan: it is called once per project, and scanning
every parents set each time made role assignment O(n²) in the number of
projects for an answer already known while the map was built.
Sourcepub fn role_of(&self, name: &str) -> ProjectRole
pub fn role_of(&self, name: &str) -> ProjectRole
Where name sits in the hierarchy, from its own in/out degree.
Sourcepub fn has_any_external_refs(&self) -> bool
pub fn has_any_external_refs(&self) -> bool
Whether any project carries a persisted external-ref edge at all.
Sourcepub fn busiest_hub(&self) -> Option<String>
pub fn busiest_hub(&self) -> Option<String>
The hosted project most external-ref edges point into, or None when
nothing references a hosted project (a single-repo or unlinked workspace).
Note what this is not: in a snowflake it names the busiest node, which
need not be the chain’s root. infra1/infra2 → chart → app makes
chart the hub on two inbound edges while app is what everything
ultimately depends on. That is the right answer for this function’s one job
— picking the config-key baseline the override matrix pivots on — and the
wrong answer for “where does the chain end”, which is what Self::role_of
reports instead. In a star the two coincided, which is why one field used to
serve both.
Trait Implementations§
Source§impl Clone for ProjectGraph
impl Clone for ProjectGraph
Source§fn clone(&self) -> ProjectGraph
fn clone(&self) -> ProjectGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more