lib.rs 566 B

12345678910111213141516171819202122232425
  1. #[cfg(feature = "blocking")]
  2. use once_cell::sync::Lazy;
  3. #[cfg(feature = "blocking")]
  4. use tokio::runtime::Runtime;
  5. #[cfg(feature = "blocking")]
  6. use futures_util::Future;
  7. #[cfg(feature = "wallet")]
  8. pub mod client;
  9. #[cfg(feature = "mint")]
  10. pub mod mint;
  11. #[cfg(feature = "wallet")]
  12. pub mod wallet;
  13. pub use cashu::{self, *};
  14. #[cfg(feature = "blocking")]
  15. static RUNTIME: Lazy<Runtime> = Lazy::new(|| Runtime::new().expect("Can't start Tokio runtime"));
  16. #[cfg(feature = "blocking")]
  17. pub fn block_on<F: Future>(future: F) -> F::Output {
  18. RUNTIME.block_on(future)
  19. }