assoc_static 1.0.0

Associate static objects to types
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use assoc_static::*;

#[test]
fn type_coherency() {
    struct TestType;

    assoc_static!(TestType:TestType, &'static str = "This is the test type");
    assert_eq!(TestType::get_static(), &"This is the test type");

    assoc_static!(TestType:i32, &'static str = "This is i32");
    assert_eq!(i32::get_static(), &"This is i32");
}