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§
Required Methods§
sourcefn extract<T>(&self, req: &Request<T>) -> Result<Self::Key, GovernorError>
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.