mxl_base/
about.rs

1use std::sync::OnceLock;
2
3#[derive(Debug)]
4pub struct About {
5    pub qualifier: &'static str,
6    pub organization: &'static str,
7    pub app_name: &'static str,
8    pub binary_name: &'static str,
9    pub version: &'static str,
10}
11
12static ABOUT_REGISTER: OnceLock<About> = OnceLock::new();
13
14pub(crate) fn about_init(
15    qualifier: &'static str,
16    organization: &'static str,
17    app_name: &'static str,
18    binary_name: &'static str,
19    version: &'static str,
20) {
21    ABOUT_REGISTER
22        .set(About {
23            qualifier,
24            organization,
25            app_name,
26            binary_name,
27            version,
28        })
29        .expect("Already initialized");
30}
31
32pub fn about() -> &'static About {
33    ABOUT_REGISTER.get().expect("Initialize first")
34}