[][src]Macro ts_static::ts_static_with_default

macro_rules! ts_static_with_default {
    ($name:ident, $type_ty: ty,$default_function:ident) => { ... };
}

Same as ts_static only can be assigned a value from a function

Calue must be identifier of a function

Example

use lazy_static::lazy_static;
use ts_static::*;

fn my_default() -> i32 { 123 }

ts_static_with_default!(MY_STATIC, i32, my_default);
MY_STATIC.with(|x| {
        assert_eq!(123, *x);
    });