Implement dummy Mutex, Condvar and RwLock
[rust-lightning] / lightning / src / lib.rs
index 9bf9470458f8310f005788769d781b74055fd835..14445710655b277f32eaeb1033a475b3b3c53c9e 100644 (file)
@@ -31,7 +31,9 @@
 #![cfg_attr(all(any(test, feature = "_test_utils"), feature = "unstable"), feature(test))]
 #[cfg(all(any(test, feature = "_test_utils"), feature = "unstable"))] extern crate test;
 
+extern crate alloc;
 extern crate bitcoin;
+extern crate core;
 #[cfg(any(test, feature = "_test_utils"))] extern crate hex;
 #[cfg(any(test, feature = "fuzztarget", feature = "_test_utils"))] extern crate regex;
 
@@ -40,3 +42,22 @@ pub mod util;
 pub mod chain;
 pub mod ln;
 pub mod routing;
+
+mod prelude {
+       #[cfg(feature = "hashbrown")]
+       extern crate hashbrown;
+
+       pub use alloc::{vec, vec::Vec, string::String, collections::VecDeque};
+       #[cfg(not(feature = "hashbrown"))]
+       pub use std::collections::{HashMap, HashSet, hash_map};
+       #[cfg(feature = "hashbrown")]
+       pub use self::hashbrown::{HashMap, HashSet, hash_map};
+}
+
+#[cfg(feature = "std")]
+mod sync {
+       pub use ::std::sync::{Arc, Mutex, Condvar, MutexGuard, RwLock, RwLockReadGuard};
+}
+
+#[cfg(not(feature = "std"))]
+mod sync;