Skip to main content

KeyExtractor

Trait KeyExtractor 

Source
pub trait KeyExtractor: Send + Sync {
    // Required method
    fn extract_key(&self, req: &Request) -> Option<String>;
}
Expand description

Extracts a rate limit key from a request.

Different extractors allow rate limiting by different criteria: IP address, API key header, path, or custom logic.

Required Methods§

Source

fn extract_key(&self, req: &Request) -> Option<String>

Extract the key string from the request.

Returns None if no key can be extracted (request is not rate-limited).

Implementors§