spacegate_kernel/extension/
user_group.rs1pub mod combinator;
2pub mod implementation;
3
4use crate::SgRequest;
5
6pub trait UserGroup {
7 fn is_match(&self, req: &SgRequest) -> bool;
8}
9
10pub trait UserGroupExt: UserGroup {
11 fn and<B>(self, b: B) -> combinator::And<Self, B>
12 where
13 Self: Sized,
14 {
15 combinator::And { a: self, b }
16 }
17
18 fn or<B>(self, b: B) -> combinator::Or<Self, B>
19 where
20 Self: Sized,
21 {
22 combinator::Or { a: self, b }
23 }
24
25 fn not(self) -> combinator::Not<Self>
26 where
27 Self: Sized,
28 {
29 combinator::Not { a: self }
30 }
31
32 fn boxed(self) -> Box<dyn UserGroup>
33 where
34 Self: Sized + 'static,
35 {
36 Box::new(self)
37 }
38}
39
40impl<T: UserGroup> UserGroupExt for T {}