archunit

Struct ProjectGraphBuilder

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

Immutable query builder for dependency-graph snapshots and reports.

Implementations§

Source§

impl ProjectGraphBuilder

Source

pub fn include_external_dependencies(self) -> Self

Includes Cargo-visible external dependency targets and edges.

Source

pub fn include_self_dependencies(self) -> Self

Includes extracted marker self-edges and self-edges produced by collapsing.

Source

pub fn focus_on(self, pattern: impl Into<PatternSpec>, depth: usize) -> Self

Keeps matching nodes and their undirected neighbors up to depth hops away.

Source

pub fn reachable_from(self, pattern: impl Into<PatternSpec>) -> Self

Keeps matching nodes and every transitive outgoing dependency.

Source

pub fn dependents_of(self, pattern: impl Into<PatternSpec>) -> Self

Keeps matching nodes and every transitive incoming dependent.

Source

pub fn collapse_to_folder_depth(self, depth: usize) -> Self

Collapses file nodes to their containing folder at a positive leading path depth.

Source

pub fn collapse_by_pattern(self, expression: impl AsRef<str>) -> Self

Collapses nodes with a regular expression and the first capture ($1) as their label.

Source

pub fn collapse_by_pattern_with_replacement( self, expression: impl AsRef<str>, replacement: impl Into<String>, ) -> Self

Collapses nodes with explicit Rust regex capture-replacement syntax.

Source

pub fn titled(self, title: impl Into<String>) -> Self

Sets the snapshot title.

Source

pub fn with_check_options(self, options: CheckOptions) -> Self

Replaces the extraction options used by snapshot terminals.

Source

pub fn snapshot(&self) -> Result<GraphReportSnapshot, ArchUnitError>

Extracts the project and returns the renderer-neutral queried snapshot.

Source

pub fn summary(&self) -> Result<GraphReportSummary, ArchUnitError>

Extracts the project and returns only the queried snapshot counts.

Source

pub fn render(&self, format: GraphReportFormat) -> Result<String, ArchUnitError>

Extracts once and renders the queried snapshot as format.

Source

pub fn to_dot(&self) -> Result<String, ArchUnitError>

Extracts once and renders Graphviz DOT.

Source

pub fn to_mermaid(&self) -> Result<String, ArchUnitError>

Extracts once and renders Mermaid flowchart source.

Source

pub fn to_d2(&self) -> Result<String, ArchUnitError>

Extracts once and renders D2 diagram source.

Source

pub fn to_csv(&self) -> Result<String, ArchUnitError>

Extracts once and renders aggregated dependency CSV.

Source

pub fn to_json(&self) -> Result<String, ArchUnitError>

Extracts once and renders complete snapshot JSON.

Source

pub fn to_html(&self) -> Result<String, ArchUnitError>

Extracts once and renders a self-contained offline HTML report.

Source

pub fn export( &self, format: GraphReportFormat, output_path: impl AsRef<Path>, ) -> Result<(), ArchUnitError>

Extracts once, renders format, and writes it as UTF-8.

Source

pub fn export_as_dot( &self, output_path: impl AsRef<Path>, ) -> Result<(), ArchUnitError>

Extracts once and exports Graphviz DOT as UTF-8.

Source

pub fn export_as_mermaid( &self, output_path: impl AsRef<Path>, ) -> Result<(), ArchUnitError>

Extracts once and exports Mermaid flowchart source as UTF-8.

Source

pub fn export_as_d2( &self, output_path: impl AsRef<Path>, ) -> Result<(), ArchUnitError>

Extracts once and exports D2 diagram source as UTF-8.

Source

pub fn export_as_csv( &self, output_path: impl AsRef<Path>, ) -> Result<(), ArchUnitError>

Extracts once and exports aggregated dependency CSV as UTF-8.

Source

pub fn export_as_json( &self, output_path: impl AsRef<Path>, ) -> Result<(), ArchUnitError>

Extracts once and exports complete snapshot JSON as UTF-8.

Source

pub fn export_as_html( &self, output_path: impl AsRef<Path>, ) -> Result<(), ArchUnitError>

Extracts once and exports a self-contained offline HTML report as UTF-8.

Source

pub const fn project_locator(&self) -> &ProjectLocator

Returns where Cargo project discovery begins.

Source

pub const fn options(&self) -> &GraphQueryOptions

Returns the immutable graph query options.

Source

pub const fn check_options(&self) -> &CheckOptions

Returns the immutable extraction options.

Trait Implementations§

Source§

impl Clone for ProjectGraphBuilder

Source§

fn clone(&self) -> ProjectGraphBuilder

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ProjectGraphBuilder

Source§

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

Formats the value using the given formatter. 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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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 = 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.