From: 志宇 Date: Fri, 10 Mar 2023 00:40:27 +0000 (+1300) Subject: Add docs for `EsploraAsyncExt` and make doctests runnable X-Git-Tag: v1.0.0-alpha.0~4^2 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.CommandStringError.html?a=commitdiff_plain;h=877b6587875e75407567d9080f486eba2cb08460;p=bdk Add docs for `EsploraAsyncExt` and make doctests runnable --- diff --git a/crates/bdk/README.md b/crates/bdk/README.md index 00ce504a..9a5bd998 100644 --- a/crates/bdk/README.md +++ b/crates/bdk/README.md @@ -64,7 +64,7 @@ To persist the `Wallet` on disk, `Wallet` needs to be constructed with a **Example** -```rust,no_run +```rust use bdk::{bitcoin::Network, wallet::{AddressIndex, Wallet}}; fn main() { diff --git a/crates/esplora/README.md b/crates/esplora/README.md index 9880115b..253832a8 100644 --- a/crates/esplora/README.md +++ b/crates/esplora/README.md @@ -22,15 +22,12 @@ For async-only (with https): bdk_esplora = { version = "0.1", features = ["async-https"] } ``` -To use the extension trait: - -```rust,no_run +To use the extension traits: +```rust // for blocking use bdk_esplora::EsploraExt; // for async use bdk_esplora::EsploraAsyncExt; ``` - - - +For full examples, refer to [`example-crates/wallet_esplora`](https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_esplora) (blocking) and [`example-crates/wallet_esplora_async`](https://github.com/bitcoindevkit/bdk/tree/master/example-crates/wallet_esplora_async). diff --git a/crates/esplora/src/async_ext.rs b/crates/esplora/src/async_ext.rs index cd0d0e0f..266fd30b 100644 --- a/crates/esplora/src/async_ext.rs +++ b/crates/esplora/src/async_ext.rs @@ -12,6 +12,13 @@ use futures::stream::{FuturesOrdered, TryStreamExt}; use crate::map_confirmation_time; +/// Trait to extend [`esplora_client::AsyncClient`] functionality. +/// +/// This is the async version of [`EsploraExt`]. Refer to +/// [crate-level documentation] for more. +/// +/// [`EsploraExt`]: crate::EsploraExt +/// [crate-level documentation]: crate #[cfg(feature = "async")] #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait)]