pub struct BalanceScore {
pub coupling: CouplingMetrics,
pub score: f64,
pub alignment: f64,
pub volatility_impact: f64,
pub interpretation: BalanceInterpretation,
}Expand description
Balance score for a coupling relationship
Fields§
§coupling: CouplingMetricsThe coupling being scored
score: f64Overall balance score (0.0 - 1.0, higher = better balanced)
alignment: f64Whether strength and distance are aligned
volatility_impact: f64Impact of volatility
interpretation: BalanceInterpretationInterpretation of the score
Implementations§
Source§impl BalanceScore
impl BalanceScore
Sourcepub fn calculate(coupling: &CouplingMetrics) -> Self
pub fn calculate(coupling: &CouplingMetrics) -> Self
Calculate balance score for a coupling
The formula implements: BALANCE = (STRENGTH XOR DISTANCE) OR NOT VOLATILITY
Ideal patterns:
- Strong (1.0) + Close (0.0) → High alignment (cohesion)
- Weak (0.0) + Far (1.0) → High alignment (loose coupling)
Problematic patterns:
- Strong (1.0) + Far (1.0) → Low alignment (global complexity)
- Any + High volatility → Reduced by volatility impact
Sourcepub fn is_balanced(&self) -> bool
pub fn is_balanced(&self) -> bool
Check if this coupling is well-balanced (no action needed)
Sourcepub fn needs_refactoring(&self) -> bool
pub fn needs_refactoring(&self) -> bool
Check if this coupling needs refactoring
Trait Implementations§
Source§impl Clone for BalanceScore
impl Clone for BalanceScore
Source§fn clone(&self) -> BalanceScore
fn clone(&self) -> BalanceScore
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BalanceScore
impl RefUnwindSafe for BalanceScore
impl Send for BalanceScore
impl Sync for BalanceScore
impl Unpin for BalanceScore
impl UnwindSafe for BalanceScore
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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>
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 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>
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