Skip to main content

SelectionStrategy

Trait SelectionStrategy 

Source
pub trait SelectionStrategy: Send + Sync {
    // Required methods
    fn select<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        candidates: &'life2 [&'life3 SkillMetadata],
        ctx: &'life4 SelectionContext,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SelectionResult>, SelectError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn name(&self) -> &str;
    fn latency_class(&self) -> LatencyClass;
}
Expand description

A skill selection strategy.

Strategies are composable and async. The cascade selector runs strategies in order until one returns with sufficient confidence.

Required Methods§

Source

fn select<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, query: &'life1 str, candidates: &'life2 [&'life3 SkillMetadata], ctx: &'life4 SelectionContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<SelectionResult>, SelectError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Rank skills for a given query. Returns scored candidates.

Source

fn name(&self) -> &str

Strategy name for logging/metrics.

Source

fn latency_class(&self) -> LatencyClass

Expected latency class.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§