Skip to main content

linkrs_server/client/
statistics.rs

1use linkrs_core::SessionStatistics;
2
3#[derive(Debug)]
4pub struct StatisticsContext {
5    statistics: SessionStatistics,
6}
7
8impl Default for StatisticsContext {
9    fn default() -> Self {
10        Self::new()
11    }
12}
13
14impl StatisticsContext {
15    pub fn new() -> Self {
16        Self {
17            statistics: SessionStatistics::new(),
18        }
19    }
20
21    pub fn statistics(&self) -> &SessionStatistics {
22        &self.statistics
23    }
24}
25
26#[cfg(test)]
27mod tests {
28    use super::*;
29
30    #[test]
31    fn test_statistics_context() {
32        let context = StatisticsContext::new();
33        assert_eq!(context.statistics().last_changes(), 0);
34    }
35}