pub struct ModuleDepthMetrics {
pub module_name: String,
pub pub_function_count: usize,
pub pub_type_count: usize,
pub total_pub_params: usize,
pub generic_param_count: usize,
pub trait_bound_count: usize,
pub pub_const_count: usize,
pub implementation_loc: usize,
pub private_function_count: usize,
pub private_type_count: usize,
pub complexity_estimate: usize,
}Expand description
Metrics for measuring module depth (interface vs implementation complexity)
Fields§
§module_name: StringModule name/path
pub_function_count: usizeNumber of public functions
pub_type_count: usizeNumber of public types (structs, enums, traits)
total_pub_params: usizeTotal parameters across all public functions
generic_param_count: usizeNumber of generic type parameters in public API
trait_bound_count: usizeNumber of trait bounds in public API
pub_const_count: usizeNumber of public constants
implementation_loc: usizeTotal lines of code (excluding comments/blanks)
private_function_count: usizeNumber of private functions
private_type_count: usizeNumber of private types
complexity_estimate: usizeCyclomatic complexity estimate (branches, loops, etc.)
Implementations§
Source§impl ModuleDepthMetrics
impl ModuleDepthMetrics
pub fn new(module_name: String) -> Self
Sourcepub fn interface_complexity(&self) -> f64
pub fn interface_complexity(&self) -> f64
Calculate interface complexity score
Higher score = more complex interface
Sourcepub fn implementation_complexity(&self) -> f64
pub fn implementation_complexity(&self) -> f64
Calculate implementation complexity score
Higher score = more complex implementation (hidden behind interface)
Sourcepub fn depth_ratio(&self) -> Option<f64>
pub fn depth_ratio(&self) -> Option<f64>
Calculate module depth ratio
Depth = Implementation Complexity / Interface Complexity
- High ratio (> 5.0): Deep module (good - hides complexity)
- Low ratio (< 2.0): Shallow module (bad - interface as complex as implementation)
Returns None if interface complexity is 0
Sourcepub fn depth_classification(&self) -> ModuleDepthClass
pub fn depth_classification(&self) -> ModuleDepthClass
Classify module depth
Sourcepub fn is_shallow(&self) -> bool
pub fn is_shallow(&self) -> bool
Check if this module is considered shallow (a red flag)
Sourcepub fn avg_params_per_function(&self) -> f64
pub fn avg_params_per_function(&self) -> f64
Calculate average parameters per public function
Trait Implementations§
Source§impl Clone for ModuleDepthMetrics
impl Clone for ModuleDepthMetrics
Source§fn clone(&self) -> ModuleDepthMetrics
fn clone(&self) -> ModuleDepthMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModuleDepthMetrics
impl Debug for ModuleDepthMetrics
Source§impl Default for ModuleDepthMetrics
impl Default for ModuleDepthMetrics
Source§fn default() -> ModuleDepthMetrics
fn default() -> ModuleDepthMetrics
Auto Trait Implementations§
impl Freeze for ModuleDepthMetrics
impl RefUnwindSafe for ModuleDepthMetrics
impl Send for ModuleDepthMetrics
impl Sync for ModuleDepthMetrics
impl Unpin for ModuleDepthMetrics
impl UnwindSafe for ModuleDepthMetrics
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> 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