1use crate::core::Request;
2
3pub trait ResourceMatcher {
5 type Context;
7
8 fn do_match(&self, context: &Request<Self::Context>, input: &str, policy: &str) -> bool;
11}
12
13#[derive(Debug)]
15pub struct Default;
16
17impl ResourceMatcher for Default {
18 type Context = ();
19
20 fn do_match(&self, _context: &Request<Self::Context>, input: &str, policy: &str) -> bool {
21 input == policy
22 }
23}
24
25#[derive(Debug)]
28pub struct StartsWith;
29
30impl ResourceMatcher for StartsWith {
31 type Context = ();
32
33 fn do_match(&self, _context: &Request<Self::Context>, input: &str, policy: &str) -> bool {
34 input.starts_with(policy)
35 }
36}