Skip to main content

MatchPolicy

Enum MatchPolicy 

Source
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.

Auto Trait Implementations§

§

impl<'a> Freeze for MatchPolicy<'a>

§

impl<'a> !RefUnwindSafe for MatchPolicy<'a>

§

impl<'a> Send for MatchPolicy<'a>

§

impl<'a> Sync for MatchPolicy<'a>

§

impl<'a> Unpin for MatchPolicy<'a>

§

impl<'a> UnsafeUnpin for MatchPolicy<'a>

§

impl<'a> !UnwindSafe for MatchPolicy<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.