lib.rs 710 B

123456789101112131415161718192021222324252627
  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. #[cfg(feature = "mint")]
  12. pub mod mint;
  13. pub mod utils;
  14. #[cfg(feature = "wallet")]
  15. pub mod wallet;
  16. pub use cashu::{self, *};
  17. #[cfg(feature = "blocking")]
  18. static RUNTIME: Lazy<Runtime> = Lazy::new(|| Runtime::new().expect("Can't start Tokio runtime"));
  19. #[cfg(feature = "blocking")]
  20. pub fn block_on<F: Future>(future: F) -> F::Output {
  21. RUNTIME.block_on(future)
  22. }