Macro global_counter::global_counter[][src]

macro_rules! global_counter {
    ($name:ident, $type:ident, $value:expr) => { ... };
}

Creates a new global, generic counter, starting from the given value.

Example

type CountedType = u32;
fn main(){
    const start_value : u32 = 0;
    global_counter!(COUNTER_NAME, CountedType, start_value);
    assert_eq!(COUNTER_NAME.get_cloned(), 0);
    COUNTER_NAME.inc();
    assert_eq!(COUNTER_NAME.get_cloned(), 1);
}