pub enum MatchPolicy<'a> {
Exact,
Normalized(&'a (dyn Fn(&str) -> String + Send + Sync)),
Custom(&'a (dyn Fn(&str, &str) -> bool + Send + Sync)),
}Expand description
Borrowed matching policy for the stateless is_allowed_in entry point.
The stateful AllowlistAspect owns its entries behind an RwLock. That
is the wrong shape for codebases that treat the allowlist’s configuration
as the single source of truth and resolve it fresh on every check (so a
config reload is observed without a restart, and no cached copy can drift).
For those callers, is_allowed_in borrows the freshly-resolved entries
per call and holds nothing; MatchPolicy carries the optional
normalization or custom comparison by reference, mirroring
AllowlistAspect::with_normalizer / AllowlistAspect::with_matcher.
Variants§
Exact
Byte-equal comparison of entry and identity.
Normalized(&'a (dyn Fn(&str) -> String + Send + Sync))
Normalize both entry and identity with this function, then compare for
equality. Mirrors AllowlistAspect::with_normalizer.
Custom(&'a (dyn Fn(&str, &str) -> bool + Send + Sync))
Replace the entry-vs-identity comparison entirely. The closure receives
(entry, identity) and returns whether they match. The wildcard "*"
and empty-list short-circuits still apply before the matcher runs, so
the matcher is only consulted for non-"*" entries against a non-empty
list. Mirrors AllowlistAspect::with_matcher.