singletonum/lib.rs
1#[macro_use]
2extern crate singletonum_derive;
3extern crate once_cell;
4
5pub use singletonum_derive::*;
6pub use once_cell::sync::OnceCell;
7
8pub trait Singleton: SingletonInit {
9 fn get_instance(init: &Self::Init) -> &'static Self;
10}
11
12pub trait SingletonInit {
13 type Init;
14 fn init(init: &Self::Init) -> Self;
15}