This crate allows registering functions for guaranteed initialization during main
Example
use ;
static INIT_CALLED: AtomicBool = new;
This crate allows registering functions for guaranteed initialization during main
use std::sync::atomic::{AtomicBool, Ordering};
static INIT_CALLED: AtomicBool = AtomicBool::new(false);
#[init_hook::call_on_init]
fn init() {
INIT_CALLED.store(true, Ordering::Release);
}
fn main() {
// This is enforced by a pre-main assertion to always be included exactly once
init_hook::init!();
assert!(INIT_CALLED.load(Ordering::Acquire));
}