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 55// http://opensource.org/licenses/MIT>, at your option. This file may not be
66// copied, modified, or distributed except according to those terms.
77
8- extern crate std;
98extern crate core;
9+ extern crate std;
1010
1111use self :: std:: prelude:: v1:: * ;
1212use self :: std:: sync:: Once ;
1313pub use self :: std:: sync:: ONCE_INIT ;
1414
15- pub struct Lazy < T : Sync > ( pub Option < T > , pub Once ) ;
15+ pub struct Lazy < T : Sync > ( Option < T > , Once ) ;
1616
1717impl < T : Sync > Lazy < T > {
18+ pub const INIT : Self = Lazy ( None , ONCE_INIT ) ;
19+
1820 #[ inline( always) ]
1921 pub fn get < F > ( & ' static mut self , f : F ) -> & T
20- where F : FnOnce ( ) -> T
22+ where
23+ F : FnOnce ( ) -> T ,
2124 {
2225 {
2326 let r = & mut self . 0 ;
@@ -40,6 +43,6 @@ unsafe impl<T: Sync> Sync for Lazy<T> {}
4043#[ doc( hidden) ]
4144macro_rules! __lazy_static_create {
4245 ( $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+ } ;
4548}
You can’t perform that action at this time.
0 commit comments