]>
git.proxmox.com Git - rustc.git/blob - vendor/lazy_static-0.2.11/src/core_lazy.rs
1 // Copyright 2016 lazy-static.rs Developers
3 // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4 // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5 // http://opensource.org/licenses/MIT>, at your option. This file may not be
6 // copied, modified, or distributed except according to those terms.
12 pub struct Lazy
<T
: Sync
>(Once
<T
>);
14 impl<T
: Sync
> Lazy
<T
> {
16 pub const fn new() -> Self {
21 pub fn get
<F
>(&'
static self, builder
: F
) -> &T
22 where F
: FnOnce() -> T
24 self.0.call_once(builder
)
29 macro_rules
! __lazy_static_create
{
30 ($NAME
:ident
, $T
:ty
) => {
31 static $NAME
: $
crate::lazy
::Lazy
<$T
> = $
crate::lazy
::Lazy
::new();