KeyResolver

Trait KeyResolver 

Source
pub trait KeyResolver: Clone {
    type ErrorBody;

    // Required method
    fn key<T>(&self, req: &Request<T>) -> Result<Key, Response<Self::ErrorBody>>;
}
Expand description

Resolves a Redis key for each incoming request.

Requests with the same key are rate limited together.

Required Associated Types§

Source

type ErrorBody

The type of the response body when KeyResolver::key fails. Must match the type of the response body of the underlying service.

Required Methods§

Source

fn key<T>(&self, req: &Request<T>) -> Result<Key, Response<Self::ErrorBody>>

Attempts to resolve a key given the request, returning a custom response if unsuccessful.

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.

Implementors§