Trait InputToRateKey
pub trait InputToRateKey<Input>:
Send
+ Sync
+ 'static {
type Key: RateKey;
// Required method
fn rate_key(
&self,
input: &Input,
) -> Result<Option<Self::Key>, Box<dyn Error + Sync + Send>>;
}Available on crate feature
net only.Expand description
Derives the RateKey of an input for a
KeyedRatePolicy.
Ok(None) means the key cannot be derived for this input (e.g. no
client IP is known); how that is handled is up to the policy
(KeyedRatePolicy::with_missing_key_allowed).
Any Fn(&Input) -> Result<Option<K>, BoxError> is an extractor.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".