1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pub mod crypto;
pub mod lru;
mod refcnt;
mod time;
pub mod utils;
mod version;
pub use self::refcnt::RefCnt;
pub use self::time::Time;
pub use self::version::Version;
use std::sync::{Arc, Once, RwLock, ONCE_INIT};
use env_logger;
static INIT: Once = ONCE_INIT;
pub fn init_env() {
INIT.call_once(|| {
env_logger::try_init().ok();
crypto::Crypto::init().expect("Initialise crypto failed");
});
}
pub trait IntoRef: Sized {
fn into_ref(self) -> Arc<RwLock<Self>> {
Arc::new(RwLock::new(self))
}
}