Skip to main content

ModuleMetrics

Struct ModuleMetrics 

Source
pub struct ModuleMetrics {
Show 13 fields pub path: PathBuf, pub name: String, pub trait_impl_count: usize, pub inherent_impl_count: usize, pub function_call_count: usize, pub type_usage_count: usize, pub external_deps: Vec<String>, pub internal_deps: Vec<String>, pub type_definitions: HashMap<String, TypeDefinition>, pub function_definitions: HashMap<String, FunctionDefinition>, pub item_dependencies: Vec<ItemDependency>, pub is_test_module: bool, pub test_function_count: usize,
}
Expand description

Aggregated metrics for a module

Fields§

§path: PathBuf

Module path

§name: String

Module name

§trait_impl_count: usize

Number of trait implementations (contract coupling)

§inherent_impl_count: usize

Number of inherent implementations (intrusive coupling)

§function_call_count: usize

Number of function calls

§type_usage_count: usize

Number of struct/enum usages

§external_deps: Vec<String>

External crate dependencies

§internal_deps: Vec<String>

Internal module dependencies

§type_definitions: HashMap<String, TypeDefinition>

Type definitions in this module with visibility info

§function_definitions: HashMap<String, FunctionDefinition>

Function definitions in this module with visibility info

§item_dependencies: Vec<ItemDependency>

Item-level dependencies (function → function, function → type, etc.)

§is_test_module: bool

Whether this module is a test module (mod tests or #[cfg(test)])

§test_function_count: usize

Number of test functions (#test)

Implementations§

Source§

impl ModuleMetrics

Source

pub fn new(path: PathBuf, name: String) -> Self

Source

pub fn add_type_definition( &mut self, name: String, visibility: Visibility, is_trait: bool, )

Add a type definition to this module (simple version for backward compatibility)

Source

pub fn add_type_definition_full( &mut self, name: String, visibility: Visibility, is_trait: bool, is_newtype: bool, inner_type: Option<String>, has_serde_derive: bool, public_field_count: usize, total_field_count: usize, )

Add a type definition with full details

Source

pub fn add_function_definition(&mut self, name: String, visibility: Visibility)

Add a function definition to this module (simple version for backward compatibility)

Source

pub fn add_function_definition_full( &mut self, name: String, visibility: Visibility, param_count: usize, primitive_param_count: usize, param_types: Vec<String>, )

Add a function definition with full details

Source

pub fn get_type_visibility(&self, name: &str) -> Option<Visibility>

Get visibility of a type defined in this module

Source

pub fn public_type_count(&self) -> usize

Count public types

Source

pub fn private_type_count(&self) -> usize

Count non-public types

Source

pub fn average_strength(&self) -> f64

Calculate average integration strength

Source

pub fn newtype_count(&self) -> usize

Count newtypes in this module

Source

pub fn serde_type_count(&self) -> usize

Count types with serde derives

Source

pub fn newtype_ratio(&self) -> f64

Calculate newtype usage ratio (newtypes / total non-trait types)

Source

pub fn types_with_public_fields(&self) -> usize

Count types with public fields

Source

pub fn function_count(&self) -> usize

Total function count

Source

pub fn functions_with_primitive_obsession(&self) -> Vec<&FunctionDefinition>

Count functions with high primitive parameter ratio (potential Primitive Obsession)

Source

pub fn is_god_module( &self, max_functions: usize, max_types: usize, max_impls: usize, ) -> bool

Check if this module is a potential “God Module” (too many functions, types, or implementations)

Trait Implementations§

Source§

impl Clone for ModuleMetrics

Source§

fn clone(&self) -> ModuleMetrics

Returns a duplicate 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 ModuleMetrics

Source§

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

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

impl Default for ModuleMetrics

Source§

fn default() -> ModuleMetrics

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> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = 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
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,