Skip to main content

ModuleGraph

Struct ModuleGraph 

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

Slotted, incrementally maintained repository module graph.

Implementations§

Source§

impl ModuleGraph

Source

pub fn new() -> Self

Creates an empty graph.

Source

pub fn set_universe_complete(&mut self, complete: bool)

Records whether the caller has supplied a complete source universe.

Source

pub fn generation(&self) -> u64

Returns the graph mutation generation.

Source

pub fn resolver_generation(&self) -> u64

Returns the resolver configuration generation.

Source

pub fn contains(&self, path: &str, hash: u64) -> bool

Returns whether an analyzed node has the supplied content hash.

Source

pub fn node(&self, path: &str) -> Option<&ModuleNode>

Returns an occupied node by path.

Source

pub fn rdeps_paths(&self, path: &str) -> Option<Vec<CompactString>>

Sorted importer paths of path — a slot-history-independent view of the reverse-dependency set.

Source

pub fn upsert_file( &mut self, analysis: &FileAnalysis, resolvers: &ResolverSet, imports_supported: bool, ) -> UpsertOutcome

Inserts or refreshes one file analysis.

imports_supported should be computed from the same language registry that produced analysis.

Source

pub fn remove_file(&mut self, path: &str) -> bool

Removes an analyzed file.

A referenced node is demoted to a stub in the same slot. Unreferenced nodes are freed, and outgoing reverse-dependency memberships are removed incrementally.

Source

pub fn reresolve_all(&mut self, resolvers: &ResolverSet)

Re-resolves every analyzed node against a new resolver generation.

Reverse dependencies are adjusted by target-set diffs for each node; they are never rebuilt globally.

Source

pub fn bump_resolver_generation(&mut self)

Advances only the resolver generation, leaving current edges stale.

Source

pub fn config_dependencies(&self) -> Vec<CompactString>

Returns the deduplicated union of resolver configuration dependencies.

Source

pub fn paths(&self) -> impl Iterator<Item = &str>

Iterates over occupied node paths in slot order.

Source

pub fn edges(&self) -> impl Iterator<Item = DepEdge> + '_

Iterates over every stored edge with graph slots materialized as paths.

Source

pub fn edge_count(&self) -> usize

Returns the total number of resolved, external, and unresolved edges.

Source

pub fn deps(&self, path: &str) -> Option<DepsResult>

Returns direct outgoing dependencies for path.

Source

pub fn rdeps_guarantee_for(&self, path: &str) -> Option<Guarantee>

Reverse-dependency guarantee without materializing importer edges.

Source

pub fn rdeps_bounded(&self, path: &str, limit: usize) -> Option<DepsResult>

Returns at most limit stored edges that directly target path.

Source

pub fn rdeps(&self, path: &str) -> Option<DepsResult>

Returns all stored edges that directly target path.

Source

pub fn neighborhood(&self, path: &str, depth: u32) -> Option<NeighborhoodResult>

Traverses both dependency directions to depth edges from path.

Trait Implementations§

Source§

impl Debug for ModuleGraph

Source§

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

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

impl Default for ModuleGraph

Source§

fn default() -> ModuleGraph

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more