Skip to main content

DynServiceMatcher

Trait DynServiceMatcher 

pub trait DynServiceMatcher<Input>:
    Send
    + Sync
    + 'static {
    type Service: Send + 'static;
    type Error: Send + 'static;
    type ModifiedInput: Send + 'static;

    // Required method
    fn match_service_box(
        &self,
        input: Input,
    ) -> Pin<Box<dyn Future<Output = Result<ServiceMatch<Self::ModifiedInput, Self::Service>, Self::Error>> + Send + '_>>;
}
Expand description

Dynamic-dispatch interface for ServiceMatcher.

This is mainly useful behind BoxServiceMatcher, but is public so crates building their own matcher containers can reuse the same pattern.

Required Associated Types§

type Service: Send + 'static

The value returned when a match succeeds.

type Error: Send + 'static

The error that can happen while evaluating the matcher.

type ModifiedInput: Send + 'static

The input after matcher evaluation.

Required Methods§

fn match_service_box( &self, input: Input, ) -> Pin<Box<dyn Future<Output = Result<ServiceMatch<Self::ModifiedInput, Self::Service>, Self::Error>> + Send + '_>>

Attempt to select a service for input.

Implementors§

§

impl<Input, T> DynServiceMatcher<Input> for T
where T: ServiceMatcher<Input>,

§

type Service = <T as ServiceMatcher<Input>>::Service

§

type Error = <T as ServiceMatcher<Input>>::Error

§

type ModifiedInput = <T as ServiceMatcher<Input>>::ModifiedInput