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: PathBufModule path
name: StringModule name
trait_impl_count: usizeNumber of trait implementations (contract coupling)
inherent_impl_count: usizeNumber of inherent implementations (intrusive coupling)
function_call_count: usizeNumber of function calls
type_usage_count: usizeNumber 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: boolWhether this module is a test module (mod tests or #[cfg(test)])
test_function_count: usizeNumber of test functions (#test)
Implementations§
Source§impl ModuleMetrics
impl ModuleMetrics
pub fn new(path: PathBuf, name: String) -> Self
Sourcepub fn add_type_definition(
&mut self,
name: String,
visibility: Visibility,
is_trait: bool,
)
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)
Sourcepub 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,
)
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
Sourcepub fn add_function_definition(&mut self, name: String, visibility: Visibility)
pub fn add_function_definition(&mut self, name: String, visibility: Visibility)
Add a function definition to this module (simple version for backward compatibility)
Sourcepub fn add_function_definition_full(
&mut self,
name: String,
visibility: Visibility,
param_count: usize,
primitive_param_count: usize,
param_types: Vec<String>,
)
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
Sourcepub fn get_type_visibility(&self, name: &str) -> Option<Visibility>
pub fn get_type_visibility(&self, name: &str) -> Option<Visibility>
Get visibility of a type defined in this module
Sourcepub fn public_type_count(&self) -> usize
pub fn public_type_count(&self) -> usize
Count public types
Sourcepub fn private_type_count(&self) -> usize
pub fn private_type_count(&self) -> usize
Count non-public types
Sourcepub fn average_strength(&self) -> f64
pub fn average_strength(&self) -> f64
Calculate average integration strength
Sourcepub fn newtype_count(&self) -> usize
pub fn newtype_count(&self) -> usize
Count newtypes in this module
Sourcepub fn serde_type_count(&self) -> usize
pub fn serde_type_count(&self) -> usize
Count types with serde derives
Sourcepub fn newtype_ratio(&self) -> f64
pub fn newtype_ratio(&self) -> f64
Calculate newtype usage ratio (newtypes / total non-trait types)
Sourcepub fn types_with_public_fields(&self) -> usize
pub fn types_with_public_fields(&self) -> usize
Count types with public fields
Sourcepub fn function_count(&self) -> usize
pub fn function_count(&self) -> usize
Total function count
Sourcepub fn functions_with_primitive_obsession(&self) -> Vec<&FunctionDefinition>
pub fn functions_with_primitive_obsession(&self) -> Vec<&FunctionDefinition>
Count functions with high primitive parameter ratio (potential Primitive Obsession)
Trait Implementations§
Source§impl Clone for ModuleMetrics
impl Clone for ModuleMetrics
Source§fn clone(&self) -> ModuleMetrics
fn clone(&self) -> ModuleMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModuleMetrics
impl Debug for ModuleMetrics
Source§impl Default for ModuleMetrics
impl Default for ModuleMetrics
Source§fn default() -> ModuleMetrics
fn default() -> ModuleMetrics
Auto Trait Implementations§
impl Freeze for ModuleMetrics
impl RefUnwindSafe for ModuleMetrics
impl Send for ModuleMetrics
impl Sync for ModuleMetrics
impl Unpin for ModuleMetrics
impl UnsafeUnpin for ModuleMetrics
impl UnwindSafe for ModuleMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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