lib.rs 752 B

123456789101112131415161718192021222324252627282930
  1. #[cfg(all(target_arch = "wasm32", feature = "blocking"))]
  2. compile_error!("`blocking` feature can't be enabled for WASM targets");
  3. #[cfg(feature = "blocking")]
  4. use futures_util::Future;
  5. #[cfg(feature = "blocking")]
  6. use once_cell::sync::Lazy;
  7. #[cfg(feature = "blocking")]
  8. use tokio::runtime::Runtime;
  9. #[cfg(feature = "wallet")]
  10. pub mod client;
  11. mod localstore;
  12. #[cfg(feature = "mint")]
  13. pub mod mint;
  14. pub mod utils;
  15. #[cfg(feature = "wallet")]
  16. pub mod wallet;
  17. pub use bip39::Mnemonic;
  18. pub use cashu::{self, *};
  19. #[cfg(feature = "blocking")]
  20. static RUNTIME: Lazy<Runtime> = Lazy::new(|| Runtime::new().expect("Can't start Tokio runtime"));
  21. #[cfg(feature = "blocking")]
  22. pub fn block_on<F: Future>(future: F) -> F::Output {
  23. RUNTIME.block_on(future)
  24. }