Last active
August 29, 2015 13:55
-
-
Save Kimundi/8781753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy_init! { | |
static ref map: T = new_T(); | |
} | |
=> | |
static map: lazy1::Lazy = lazy1::Lazy; | |
mod lazy1 { | |
static mut map: *T = 0 as *T; | |
struct Lazy; | |
impl Lazy { | |
fn get(&self) -> &'static T { | |
do_locked(|| { | |
if map == 0 { | |
map = ~new_T() as *T; | |
} | |
map as &'static T | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment