arma_rs/context/group.rs
1use std::sync::Arc;
2
3use crate::{ContextState, State};
4
5/// Contains information about the current group
6pub struct GroupContext {
7 state: Arc<State>,
8}
9
10impl GroupContext {
11 pub(crate) fn new(state: Arc<State>) -> Self {
12 Self { state }
13 }
14}
15
16impl ContextState for GroupContext {
17 fn get<T>(&self) -> Option<&T>
18 where
19 T: Send + Sync + 'static,
20 {
21 self.state.try_get()
22 }
23
24 fn set<T>(&self, value: T) -> bool
25 where
26 T: Send + Sync + 'static,
27 {
28 self.state.set(value)
29 }
30}