larust_core/state.rs
1use crate::{AppPaths, Config};
2use std::sync::Arc;
3
4/// Explicit, clonable application state for code that should not depend on
5/// Larust's legacy process-wide helper facades.
6#[derive(Debug, Clone)]
7pub struct AppState {
8 config: Arc<Config>,
9 paths: Arc<AppPaths>,
10}
11
12impl AppState {
13 pub(crate) fn new(config: Config, paths: AppPaths) -> Self {
14 Self {
15 config: Arc::new(config),
16 paths: Arc::new(paths),
17 }
18 }
19
20 pub fn config(&self) -> &Config {
21 &self.config
22 }
23
24 pub fn paths(&self) -> &AppPaths {
25 &self.paths
26 }
27}