From 9bafdfe2d422d53b411490b1b0458900591a290e Mon Sep 17 00:00:00 2001 From: Alekos Filini Date: Thu, 10 Dec 2020 11:38:42 +0100 Subject: [PATCH] [docs] Various fixes to the docs --- src/blockchain/mod.rs | 2 +- src/descriptor/dsl.rs | 3 ++- src/descriptor/mod.rs | 5 +++-- src/keys/bip39.rs | 5 +++++ src/wallet/coin_selection.rs | 5 +++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/blockchain/mod.rs b/src/blockchain/mod.rs index 6711e51e..9f021275 100644 --- a/src/blockchain/mod.rs +++ b/src/blockchain/mod.rs @@ -95,7 +95,7 @@ pub trait BlockchainMarker {} /// The [`BlockchainMarker`] marker trait is automatically implemented for [`Blockchain`] types impl BlockchainMarker for T {} -/// Type that only implements [`Blockchain`] and is always "offline" +/// Type that only implements [`BlockchainMarker`] and is always "offline" pub struct OfflineBlockchain; impl BlockchainMarker for OfflineBlockchain {} diff --git a/src/descriptor/dsl.rs b/src/descriptor/dsl.rs index 969fb845..e75e1b58 100644 --- a/src/descriptor/dsl.rs +++ b/src/descriptor/dsl.rs @@ -201,7 +201,8 @@ macro_rules! impl_sortedmulti { /// Macro to write full descriptors with code /// -/// This macro expands to an object of type `Result<(Descriptor, KeyMap, ValidNetworks), Error>`. +/// This macro expands to a `Result` of +/// [`DescriptorTemplateOut`](super::template::DescriptorTemplateOut) and [`Error`](crate::Error) /// /// ## Example /// diff --git a/src/descriptor/mod.rs b/src/descriptor/mod.rs index cae0654a..38cc8d8e 100644 --- a/src/descriptor/mod.rs +++ b/src/descriptor/mod.rs @@ -52,7 +52,8 @@ pub mod template; pub use self::checksum::get_checksum; use self::error::Error; pub use self::policy::Policy; -use crate::keys::{KeyError, ToDescriptorKey, ValidNetworks}; +use self::template::DescriptorTemplateOut; +use crate::keys::{KeyError, ToDescriptorKey}; use crate::wallet::signer::SignersContainer; use crate::wallet::utils::{descriptor_to_pk_ctx, SecpCtx}; @@ -151,7 +152,7 @@ impl ToWalletDescriptor for (ExtendedDescriptor, KeyMap) { } } -impl ToWalletDescriptor for (ExtendedDescriptor, KeyMap, ValidNetworks) { +impl ToWalletDescriptor for DescriptorTemplateOut { fn to_wallet_descriptor( self, network: Network, diff --git a/src/keys/bip39.rs b/src/keys/bip39.rs index bf9837c4..b7f7765e 100644 --- a/src/keys/bip39.rs +++ b/src/keys/bip39.rs @@ -36,8 +36,10 @@ use bip39::{Language, Mnemonic, MnemonicType, Seed}; use super::{any_network, DerivableKey, DescriptorKey, GeneratableKey, GeneratedKey, KeyError}; +/// Type for a BIP39 mnemonic with an optional passphrase pub type MnemonicWithPassphrase = (Mnemonic, Option); +#[cfg_attr(docsrs, doc(cfg(feature = "keys-bip39")))] impl DerivableKey for Seed { fn add_metadata( self, @@ -54,6 +56,7 @@ impl DerivableKey for Seed { } } +#[cfg_attr(docsrs, doc(cfg(feature = "keys-bip39")))] impl DerivableKey for MnemonicWithPassphrase { fn add_metadata( self, @@ -66,6 +69,7 @@ impl DerivableKey for MnemonicWithPassphrase { } } +#[cfg_attr(docsrs, doc(cfg(feature = "keys-bip39")))] impl DerivableKey for Mnemonic { fn add_metadata( self, @@ -76,6 +80,7 @@ impl DerivableKey for Mnemonic { } } +#[cfg_attr(docsrs, doc(cfg(feature = "keys-bip39")))] impl GeneratableKey for Mnemonic { type Entropy = [u8; 32]; diff --git a/src/wallet/coin_selection.rs b/src/wallet/coin_selection.rs index 5063f745..7f6656b0 100644 --- a/src/wallet/coin_selection.rs +++ b/src/wallet/coin_selection.rs @@ -257,8 +257,9 @@ impl OutputGroup { } } -/// Branch and bound coin selection. Code adapted from Bitcoin Core's implementation and from Mark -/// Erhardt Master's Thesis (http://murch.one/wp-content/uploads/2016/11/erhardt2016coinselection.pdf) +/// Branch and bound coin selection +/// +/// Code adapted from Bitcoin Core's implementation and from Mark Erhardt Master's Thesis: #[derive(Debug)] pub struct BranchAndBoundCoinSelection { size_of_change: u64,