use crate::core::Request;
pub trait ResourceMatcher {
type Context;
fn do_match(&self, context: &Request<Self::Context>, input: &str, policy: &str) -> bool;
}
#[derive(Debug)]
pub struct Default;
impl ResourceMatcher for Default {
type Context = ();
fn do_match(&self, _context: &Request<Self::Context>, input: &str, policy: &str) -> bool {
input == policy
}
}
#[derive(Debug)]
pub struct StartsWith;
impl ResourceMatcher for StartsWith {
type Context = ();
fn do_match(&self, _context: &Request<Self::Context>, input: &str, policy: &str) -> bool {
input.starts_with(policy)
}
}