Trait ServiceMatcher
pub trait ServiceMatcher<Input>:
Send
+ Sync
+ 'static {
type Service: Send + 'static;
type Error: Send + 'static;
type ModifiedInput: Send + 'static;
// Required method
fn match_service(
&self,
input: Input,
) -> impl Future<Output = Result<ServiceMatch<Self::ModifiedInput, Self::Service>, Self::Error>> + Send;
// Provided methods
fn into_match_service(
self,
input: Input,
) -> impl Future<Output = Result<ServiceMatch<Self::ModifiedInput, Self::Service>, Self::Error>> + Send
where Self: Sized,
Input: Send { ... }
fn boxed(
self,
) -> BoxServiceMatcher<Input, Self::Service, Self::Error, Self::ModifiedInput>
where Self: Sized { ... }
}Expand description
Selects a concrete service for an input.
This is useful when the service decision itself depends on runtime input, while still preserving the selected value for later processing.
Required Associated Types§
type ModifiedInput: Send + 'static
type ModifiedInput: Send + 'static
Input returned by matching functions, it might be same as the original input but it can also be modified.
Required Methods§
fn match_service(
&self,
input: Input,
) -> impl Future<Output = Result<ServiceMatch<Self::ModifiedInput, Self::Service>, Self::Error>> + Send
fn match_service( &self, input: Input, ) -> impl Future<Output = Result<ServiceMatch<Self::ModifiedInput, Self::Service>, Self::Error>> + Send
Attempt to select a service for input.
Provided Methods§
fn into_match_service(
self,
input: Input,
) -> impl Future<Output = Result<ServiceMatch<Self::ModifiedInput, Self::Service>, Self::Error>> + Send
fn into_match_service( self, input: Input, ) -> impl Future<Output = Result<ServiceMatch<Self::ModifiedInput, Self::Service>, Self::Error>> + Send
Attempt to select a service for input, consuming the matcher.
Override this when the matcher stores services by value and can return them without cloning.
fn boxed(
self,
) -> BoxServiceMatcher<Input, Self::Service, Self::Error, Self::ModifiedInput>where
Self: Sized,
fn boxed(
self,
) -> BoxServiceMatcher<Input, Self::Service, Self::Error, Self::ModifiedInput>where
Self: Sized,
Box this matcher for dynamic dispatch.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.