arma-rs 1.12.1

Arma 3 Extensions in Rust
Documentation
use std::sync::Arc;

use crate::{ContextState, State};

/// Contains information about the current group
pub struct GroupContext {
    state: Arc<State>,
}

impl GroupContext {
    pub(crate) const fn new(state: Arc<State>) -> Self {
        Self { state }
    }
}

impl ContextState for GroupContext {
    fn get<T>(&self) -> Option<&T>
    where
        T: Send + Sync + 'static,
    {
        self.state.try_get()
    }

    fn set<T>(&self, value: T) -> bool
    where
        T: Send + Sync + 'static,
    {
        self.state.set(value)
    }
}