1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::hash::Hash;
use super::{server::Server, user::UserKey};
pub struct UserScopeMut<'s, E: Copy + Eq + Hash + Send + Sync> {
server: &'s mut Server<E>,
key: UserKey,
}
impl<'s, E: Copy + Eq + Hash + Send + Sync> UserScopeMut<'s, E> {
pub fn new(server: &'s mut Server<E>, key: &UserKey) -> Self {
UserScopeMut { server, key: *key }
}
pub fn include(&mut self, entity: &E) -> &mut Self {
self.server.user_scope_set_entity(&self.key, entity, true);
self
}
pub fn exclude(&mut self, entity: &E) -> &mut Self {
self.server.user_scope_set_entity(&self.key, entity, false);
self
}
pub fn clear(&mut self) -> &mut Self {
self.server.user_scope_remove_user(&self.key);
self
}
}