Fix lazy initialisation bug for parametizability (#2046)

remove lazy and compute prefix at compile time
This commit is contained in:
thiolliere
2019-03-19 18:05:07 +01:00
committed by GitHub
parent fc16677e4d
commit 3501746fa9
11 changed files with 156 additions and 68 deletions
-15
View File
@@ -64,21 +64,6 @@ pub use runtime_io::print;
#[doc(inline)]
pub use srml_support_procedural::decl_storage;
pub mod lazy {
use spin::Once;
pub struct Lazy<T: Sync>(Once<T>);
impl <T: Sync> Lazy<T> {
pub const INIT: Self = Lazy(Once::INIT);
#[inline(always)]
pub fn get<F>(&'static self, builder: F) -> &T where F: FnOnce() -> T {
self.0.call_once(builder)
}
}
}
#[macro_export]
macro_rules! fail {
( $y:expr ) => {{