aboutsummaryrefslogtreecommitdiffstats
path: root/examples/scope.rs
blob: cd175704eb85fda5ca7ead43b42f5b41493d9939 (plain)
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)
}