#static #lazy-evaluation #init

nightly macro lazing

A macro like lazy_static can initialize static variables

2 releases

0.1.1 Mar 29, 2020
0.1.0 Mar 28, 2020

#64 in #init

MIT license

6KB
75 lines

Lazing

A macro like lazy_static can initialize static variables.

Usage

use std::ops::Deref;
#[lazy]
static NAME: String = "Hello".to_owned();

fn main() {
    println!("{}",NAME.deref());
}
 

lib.rs:

A macro like lazy_static can initialize static variables.

Usage

#[lazy]
static NAME: String = "Hello".to_string();

fn main() {
   println!("{}",NAME.deref());
}
 

Dependencies

~1.5MB
~37K SLoC