1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use clint::HandlerArray; static HANDLERS: HandlerArray = HandlerArray::new(); fn main() { let mut cl = || println!("whoa!"); HANDLERS.with_overrides(|arr| { arr.register(0, &mut cl); dummy_int(); dummy2_int(); }); } fn dummy_int() { HANDLERS.call(0) } fn dummy2_int() { HANDLERS.call(1) }