From 0f2dc05c0814e9857428bd0f2168e6ee13579d3d Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Sun, 13 Dec 2020 20:36:38 -0800 Subject: [PATCH] [docs] Add docs to the 'descriptor' module --- src/descriptor/error.rs | 14 +++++++------- src/descriptor/mod.rs | 5 ++--- src/descriptor/policy.rs | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/descriptor/error.rs b/src/descriptor/error.rs index 151487da..e470fea9 100644 --- a/src/descriptor/error.rs +++ b/src/descriptor/error.rs @@ -35,9 +35,9 @@ pub enum Error { InvalidHDKeyPath, //KeyParsingError(String), - #[allow(missing_docs)] + /// Error thrown while working with [`keys`](crate::keys) Key(crate::keys::KeyError), - #[allow(missing_docs)] + /// Error while extracting and manipulating policies Policy(crate::descriptor::policy::PolicyError), //InputIndexDoesntExist, @@ -47,15 +47,15 @@ pub enum Error { InvalidDescriptorCharacter(char), //CantDeriveWithMiniscript, - #[allow(missing_docs)] + /// BIP32 error BIP32(bitcoin::util::bip32::Error), - #[allow(missing_docs)] + /// Error during base58 decoding Base58(bitcoin::util::base58::Error), - #[allow(missing_docs)] + /// Key-related error PK(bitcoin::util::key::Error), - #[allow(missing_docs)] + /// Miniscript error Miniscript(miniscript::Error), - #[allow(missing_docs)] + /// Hex decoding error Hex(bitcoin::hashes::hex::Error), } diff --git a/src/descriptor/mod.rs b/src/descriptor/mod.rs index 4a82df34..ec00133f 100644 --- a/src/descriptor/mod.rs +++ b/src/descriptor/mod.rs @@ -45,7 +45,6 @@ pub mod checksum; mod dsl; pub mod error; pub mod policy; -#[allow(missing_docs)] // TODO add missing docs and remove this allow pub mod template; pub use self::checksum::get_checksum; @@ -65,9 +64,9 @@ pub type ExtendedDescriptor = Descriptor; /// [`psbt::Output`]: bitcoin::util::psbt::Output pub type HDKeyPaths = BTreeMap; -#[allow(missing_docs)] // TODO add missing docs and remove this allow /// Trait for types which can be converted into an [`ExtendedDescriptor`] and a [`KeyMap`] usable by a wallet in a specific [`Network`] pub trait ToWalletDescriptor { + /// Convert to wallet descriptor fn to_wallet_descriptor( self, network: Network, @@ -187,9 +186,9 @@ impl ToWalletDescriptor for (ExtendedDescriptor, KeyMap, ValidNetworks) { } } -#[allow(missing_docs)] // TODO add missing docs and remove this allow /// Trait implemented on [`Descriptor`]s to add a method to extract the spending [`policy`] pub trait ExtractPolicy { + /// Extract the spending [`policy`] fn extract_policy( &self, signers: &SignersContainer, diff --git a/src/descriptor/policy.rs b/src/descriptor/policy.rs index 37b18dd2..d14d2da4 100644 --- a/src/descriptor/policy.rs +++ b/src/descriptor/policy.rs @@ -139,7 +139,7 @@ pub enum SatisfiableItem { }, /// Relative timelock locktime RelativeTimelock { - /// The timelock value + /// The locktime value value: u32, }, /// Multi-signature public keys with threshold count