Collect all lightning std::sync imports under crate::sync
[rust-lightning] / lightning / src / lib.rs
index 3c09f386753040320c27199086790b022944df26..1088063540c97f51e03d0bcebbcde1773fb83970 100644 (file)
@@ -31,6 +31,7 @@
 #![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;
@@ -41,3 +42,18 @@ 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};
+}
+
+mod sync {
+       pub use ::std::sync::{Arc, Mutex, Condvar, MutexGuard, RwLock, RwLockReadGuard};
+}