Skip to main content

nil_core/world/
stats.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use crate::infrastructure::stats::InfrastructureStats;
5use crate::world::config::WorldConfig;
6use serde::{Deserialize, Serialize};
7use std::sync::Arc;
8
9#[derive(Clone, Debug, Deserialize, Serialize)]
10#[serde(rename_all = "camelCase")]
11pub struct WorldStats {
12  pub(super) infrastructure: Arc<InfrastructureStats>,
13}
14
15impl WorldStats {
16  pub fn new(config: &WorldConfig) -> Self {
17    Self {
18      infrastructure: Arc::new(InfrastructureStats::new(config)),
19    }
20  }
21
22  #[inline]
23  pub fn infrastructure(&self) -> Arc<InfrastructureStats> {
24    Arc::clone(&self.infrastructure)
25  }
26}