Trait tower_governor::key_extractor::KeyExtractor

source ·
pub trait KeyExtractor: Clone {
    type Key: Clone + Hash + Eq + Debug;

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

Generic structure of what is needed to extract a rate-limiting key from an incoming request.

Required Associated Types§

source

type Key: Clone + Hash + Eq + Debug

The type of the key.

Required Methods§

source

fn extract<T>(&self, req: &Request<T>) -> Result<Self::Key, GovernorError>

Extraction method, will return GovernorError response when the extract failed

Object Safety§

This trait is not object safe.

Implementors§