blackjack/
config.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright 2024 Ole Kliemann
// SPDX-License-Identifier: Apache-2.0
//
use once_cell::sync::OnceCell;

#[derive(Debug)]
pub struct Config {
    pub timeout_scaling: u16,
    pub parallel: u16,
}

static CONFIG: OnceCell<Config> = OnceCell::new();

impl Config {
    pub fn init(config: Config) {
        CONFIG.set(config).unwrap();
    }

    pub fn get() -> &'static Self {
        CONFIG.get().unwrap()
    }
}