archunit

Struct MetricsBuilder

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

Immutable file/type selection for metrics extraction.

Implementations§

Source§

impl MetricsBuilder

Source

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

Keeps source files whose final path segment matches pattern.

Source

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

Keeps source files whose containing folder matches pattern.

Source

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

Keeps source files whose normalized project path matches pattern.

Source

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

Keeps Rust type declarations whose unqualified name matches pattern.

When present, files without a matching type are omitted. File-level type and trait counts describe only the retained declarations; source-wide counts such as lines and imports remain properties of the containing file.

Source

pub fn analyze(&self) -> Result<ProjectMetricsInfo, ArchUnitError>

Extracts the selected information model with production-source defaults.

Source

pub fn analyze_with( &self, check_options: &CheckOptions, ) -> Result<ProjectMetricsInfo, ArchUnitError>

Extracts the selected information model with explicit source-target options.

Source

pub fn count(self) -> CountMetricsBuilder

Enters the built-in count metric family.

Source

pub fn lcom(self) -> LcomMetricsBuilder

Enters the lack-of-cohesion metric family for eligible Rust structs.

Source

pub fn distance(self) -> DistanceMetricsBuilder

Enters the file-component distance metric family.

Source

pub fn custom_metric<Calculation>( self, name: impl Into<String>, description: impl Into<String>, calculation: Calculation, ) -> CustomMetricSelection<Calculation>
where Calculation: Fn(&TypeInfo) -> f64,

Defines a reusable numeric metric over every selected Rust type.

The calculation receives an immutable TypeInfo and is invoked once per type on each execution. Panics from the user callback propagate normally.

Source

pub fn project_path(&self) -> Option<&Path>

Returns the explicit discovery path, or None for automatic discovery.

Trait Implementations§

Source§

impl Clone for MetricsBuilder

Source§

fn clone(&self) -> MetricsBuilder

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 MetricsBuilder

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.