File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 5
5
// http://opensource.org/licenses/MIT>, at your option. This file may not be
6
6
// copied, modified, or distributed except according to those terms.
7
7
8
- extern crate std;
9
8
extern crate core;
9
+ extern crate std;
10
10
11
11
use self :: std:: prelude:: v1:: * ;
12
12
use self :: std:: sync:: Once ;
13
13
pub use self :: std:: sync:: ONCE_INIT ;
14
14
15
- pub struct Lazy < T : Sync > ( pub Option < T > , pub Once ) ;
15
+ pub struct Lazy < T : Sync > ( Option < T > , Once ) ;
16
16
17
17
impl < T : Sync > Lazy < T > {
18
+ pub const INIT : Self = Lazy ( None , ONCE_INIT ) ;
19
+
18
20
#[ inline( always) ]
19
21
pub fn get < F > ( & ' static mut self , f : F ) -> & T
20
- where F : FnOnce ( ) -> T
22
+ where
23
+ F : FnOnce ( ) -> T ,
21
24
{
22
25
{
23
26
let r = & mut self . 0 ;
@@ -40,6 +43,6 @@ unsafe impl<T: Sync> Sync for Lazy<T> {}
40
43
#[ doc( hidden) ]
41
44
macro_rules! __lazy_static_create {
42
45
( $NAME: ident, $T: ty) => {
43
- static mut $NAME: $crate:: lazy:: Lazy <$T> = $crate:: lazy:: Lazy ( None , $crate :: lazy :: ONCE_INIT ) ;
44
- }
46
+ static mut $NAME: $crate:: lazy:: Lazy <$T> = $crate:: lazy:: Lazy :: INIT ;
47
+ } ;
45
48
}
You can’t perform that action at this time.
0 commit comments