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 serde::{Deserialize, Serialize};
6use std::sync::Arc;
7
8#[derive(Clone, Debug, Deserialize, Serialize)]
9#[serde(rename_all = "camelCase")]
10pub struct WorldStats {
11  pub(super) infrastructure: Arc<InfrastructureStats>,
12}
13
14#[expect(clippy::new_without_default)]
15impl WorldStats {
16  pub fn new() -> Self {
17    Self {
18      infrastructure: Arc::new(InfrastructureStats::new()),
19    }
20  }
21
22  #[inline]
23  pub fn infrastructure(&self) -> Arc<InfrastructureStats> {
24    Arc::clone(&self.infrastructure)
25  }
26}