pub struct PathScorer { /* private fields */ }Expand description
Aggregates multiple path scorers into a single scoring function.
Implementations§
Source§impl PathScorer
impl PathScorer
Sourcepub const DEFAULT_RELIABILITY_IMPACT: f32 = 1.0
pub const DEFAULT_RELIABILITY_IMPACT: f32 = 1.0
Default impact weight for reliability scorer.
Sourcepub const DEFAULT_LENGTH_IMPACT: f32 = 0.1
pub const DEFAULT_LENGTH_IMPACT: f32 = 0.1
Default impact weight for length scorer.
Sourcepub fn with_scorer(
self,
scorer: impl PathScoring + 'static,
impact: f32,
) -> Self
pub fn with_scorer( self, scorer: impl PathScoring + 'static, impact: f32, ) -> Self
Adds a scorer with the given impact weight.
scorer - The path scorer to add.
impact - The weight of the scorer in the final score aggregation.
e.g. Impact of 0.2 means the scorer can change the final score by up to ±0.2.
Note: The impact weight does not need to sum to 1.0 across all scorers.
Sourcepub fn score(&self, path: &PathManagerPath, now: SystemTime) -> f32
pub fn score(&self, path: &PathManagerPath, now: SystemTime) -> f32
Scores the given path by aggregating scores from all configured scorers.
Total score is the weighted sum of individual scorer scores. No Normalization is applied.
Sourcepub fn score_report(
&self,
path: &PathManagerPath,
now: SystemTime,
) -> ScoreReport
pub fn score_report( &self, path: &PathManagerPath, now: SystemTime, ) -> ScoreReport
Generates a report detailing individual scorer contributions to the total score of the path.
Trait Implementations§
Source§impl Clone for PathScorer
impl Clone for PathScorer
Source§fn clone(&self) -> PathScorer
fn clone(&self) -> PathScorer
Returns a duplicate of the value. Read more
1.0.0 · Source§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 PathScorer
impl !RefUnwindSafe for PathScorer
impl Send for PathScorer
impl Sync for PathScorer
impl Unpin for PathScorer
impl !UnwindSafe for PathScorer
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
Mutably borrows from an owned value. Read more
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request