]> Untitled Git - bdk/commit
Make the blockchain interface async again on wasm32-unknown-unknown
authorAlekos Filini <alekos.filini@gmail.com>
Mon, 20 Jul 2020 13:51:57 +0000 (15:51 +0200)
committerAlekos Filini <alekos.filini@gmail.com>
Mon, 20 Jul 2020 18:02:24 +0000 (20:02 +0200)
commit4fcf7ac89e440d34207e2c190533d94955a1b808
tree2929bdb576e37672b967d8470a6b9ffda9ed5ecc
parent4a51d50e1f728e10e87a8de99aa2c2398f067d64
Make the blockchain interface async again on wasm32-unknown-unknown

The procedural macro `#[maybe_async]` makes a method or every method of a trait
"async" whenever the target_arch is `wasm32`, and leaves them untouched on
every other platform.

The macro `maybe_await!($e:expr)` can be used to call `maybe_async` methods on
multi-platform code: it expands to `$e` on non-wasm32 platforms and to
`$e.await` on wasm32.

The macro `await_or_block!($e:expr)` can be used to contain async code as much
as possible: it expands to `tokio::runtime::Runtime::new().unwrap().block_on($e)`
on non-wasm32 platforms, and to `$e.await` on wasm32.
.travis.yml
Cargo.toml
macros/Cargo.toml [new file with mode: 0644]
macros/src/lib.rs [new file with mode: 0644]
src/blockchain/esplora.rs
src/blockchain/mod.rs
src/blockchain/utils.rs
src/cli.rs
src/lib.rs
src/wallet/mod.rs