>>244
おまえらのために作ったった

// お手軽グローバル変数キット
#[macro_use]
mod x {
pub struct X<T>(pub std::sync::LazyLock<std::sync::Mutex<T>>);
#[macro_export]
macro_rules! x_init { ($x:expr) => { X(std::sync::LazyLock::new(|| std::sync::Mutex::new($x))) } }
#[macro_export]
macro_rules! x { ($x:ident) => (*($x.0.lock().unwrap())) }
}
use x::X;

// グローバル変数の宣言の仕方
static FOO: X<i32> = x_init!(999);
static BAR: X<Vec<i32>> = x_init!(vec![1, 2, 3]);

// グローバル変数の使い方
fn main_() {
x!(FOO) += 1;
assert_eq!(x!(FOO), 1000);
x!(BAR).push(777);
assert_eq!(x!(BAR), [1, 2, 3, 777]);
}