lib.rs 736 B

1234567891011121314151617181920212223242526272829
  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 bip39::Mnemonic;
  17. pub use cashu::{self, *};
  18. #[cfg(feature = "blocking")]
  19. static RUNTIME: Lazy<Runtime> = Lazy::new(|| Runtime::new().expect("Can't start Tokio runtime"));
  20. #[cfg(feature = "blocking")]
  21. pub fn block_on<F: Future>(future: F) -> F::Output {
  22. RUNTIME.block_on(future)
  23. }