Skip to main content

ProjectGraph

Struct ProjectGraph 

Source
pub struct ProjectGraph { /* private fields */ }
Expand description

A workspace’s project-level dependency shape.

Implementations§

Source§

impl ProjectGraph

Source

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.

Source

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.

Source

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.

Source

pub fn role_of(&self, name: &str) -> ProjectRole

Where name sits in the hierarchy, from its own in/out degree.

Source

pub fn has_any_external_refs(&self) -> bool

Whether any project carries a persisted external-ref edge at all.

Source

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/infra2chartapp 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

Source§

fn clone(&self) -> ProjectGraph

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProjectGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProjectGraph

Source§

fn default() -> ProjectGraph

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.