

[](https://crates.io/crates/init-hook)
[](https://docs.rs/init-hook)
This crate allows registering functions for guaranteed initialization during main
# Example
```rust
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));
}
```