pub struct ScorerRegistry { /* private fields */ }Expand description
Scorer registry for built-in and custom scorers
Implementations§
Source§impl ScorerRegistry
impl ScorerRegistry
Sourcepub fn register_scorer(&mut self, scorer: Arc<dyn CustomScorer>)
pub fn register_scorer(&mut self, scorer: Arc<dyn CustomScorer>)
Register a custom scorer
Sourcepub fn register_closure_scorer<F>(
&mut self,
name: String,
scorer_fn: F,
higher_is_better: bool,
)
pub fn register_closure_scorer<F>( &mut self, name: String, scorer_fn: F, higher_is_better: bool, )
Register a custom scorer from a closure
Sourcepub fn get_scorer(&self, name: &str) -> Option<&Arc<dyn CustomScorer>>
pub fn get_scorer(&self, name: &str) -> Option<&Arc<dyn CustomScorer>>
Get a custom scorer by name
Sourcepub fn list_scorers(&self) -> Vec<&str>
pub fn list_scorers(&self) -> Vec<&str>
List all registered custom scorers
Sourcepub fn has_scorer(&self, name: &str) -> bool
pub fn has_scorer(&self, name: &str) -> bool
Check if a scorer is registered
Trait Implementations§
Source§impl Clone for ScorerRegistry
impl Clone for ScorerRegistry
Source§fn clone(&self) -> ScorerRegistry
fn clone(&self) -> ScorerRegistry
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 moreSource§impl Debug for ScorerRegistry
impl Debug for ScorerRegistry
Auto Trait Implementations§
impl Freeze for ScorerRegistry
impl !RefUnwindSafe for ScorerRegistry
impl Send for ScorerRegistry
impl Sync for ScorerRegistry
impl Unpin for ScorerRegistry
impl !UnwindSafe for ScorerRegistry
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> 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