pub trait Backend: Send + Sync {
// Required methods
fn id(&self) -> &str;
fn evaluate(
&self,
req: WireRequest,
deadline: Instant,
) -> impl Future<Output = Result<Evaluated, BackendError>> + Send;
// Provided method
fn replace_api_key(
&self,
key: Option<String>,
) -> Result<Option<String>, Error> { ... }
}Required Methods§
fn id(&self) -> &str
fn evaluate( &self, req: WireRequest, deadline: Instant, ) -> impl Future<Output = Result<Evaluated, BackendError>> + Send
Provided Methods§
Sourcefn replace_api_key(&self, key: Option<String>) -> Result<Option<String>, Error>
fn replace_api_key(&self, key: Option<String>) -> Result<Option<String>, Error>
Replace the bearer key used by the next evaluate.
The default ignores every key, including an empty string, and returns
Ok(None). Backends that store a bearer token refuse "" and leave
the previous key in place. On success the returned value is the
previous key, so a cascade can restore it if the other hop refuses.
A call that has already entered evaluate keeps the key it copied.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".