pub trait PathScoring:
'static
+ Send
+ Sync {
// Required methods
fn metric_name(&self) -> &'static str;
fn score(&self, path: &PathManagerPath, now: SystemTime) -> Score;
}Expand description
Trait for scoring paths based on specific metrics.
Implementors provide a method to score a path, returning a floating point score between -1.0 and 1.0. Higher scores indicate more preferred paths.
Scores from multiple implementations are aggregated to form a composite path score, which is used for selecting a preferred path.
Required Methods§
Sourcefn metric_name(&self) -> &'static str
fn metric_name(&self) -> &'static str
Name of the metric being scored. Used for debugging path scoring decisions.
Sourcefn score(&self, path: &PathManagerPath, now: SystemTime) -> Score
fn score(&self, path: &PathManagerPath, now: SystemTime) -> Score
Scores the given path, returning a floating point score.
Higher scores indicate more preferred paths.
path - The path to score.
now - The current system time for time sensitive scores.