Skip to content

Commit 12dd99d

Browse files
committed
Improve rustdoc on the MiniscriptKey trait
We want to support private keys in descriptors, in preparation improve the rustdocs on the `MiniscriptKey` trait by doing: - Use "key" instead of "pukbey". - Fix the links - Improve spacing, use header body format
1 parent f47cfd9 commit 12dd99d

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/lib.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,34 +147,39 @@ pub use crate::primitives::absolute_locktime::{AbsLockTime, AbsLockTimeError};
147147
pub use crate::primitives::relative_locktime::{RelLockTime, RelLockTimeError};
148148
pub use crate::primitives::threshold::{Threshold, ThresholdError};
149149

150-
/// Public key trait which can be converted to Hash type
150+
/// Trait representing a key which can be converted to a hash type.
151151
pub trait MiniscriptKey: Clone + Eq + Ord + fmt::Debug + fmt::Display + hash::Hash {
152-
/// Returns true if the pubkey is uncompressed. Defaults to `false`.
152+
/// Returns true if the key is serialized uncompressed, defaults to `false`.
153153
fn is_uncompressed(&self) -> bool { false }
154154

155-
/// Returns true if the pubkey is an x-only pubkey. Defaults to `false`.
155+
/// Returns true if the key is an x-only pubkey, defaults to `false`.
156156
// This is required to know what in DescriptorPublicKey to know whether the inner
157157
// key in allowed in descriptor context
158158
fn is_x_only_key(&self) -> bool { false }
159159

160-
/// Returns the number of different derivation paths in this key. Only >1 for keys
161-
/// in BIP389 multipath descriptors.
160+
/// Returns the number of different derivation paths in this key, defaults to `0`.
161+
///
162+
/// Only >1 for keys in BIP389 multipath descriptors.
162163
fn num_der_paths(&self) -> usize { 0 }
163164

164-
/// The associated [`bitcoin::hashes::sha256::Hash`] for this [`MiniscriptKey`], used in the
165-
/// sha256 fragment.
165+
/// The associated [`sha256::Hash`] for this `MiniscriptKey`, used in the sha256 fragment.
166+
///
167+
/// [`sha256::Hash`]: bitcoin::hashes::sha256::Hash
166168
type Sha256: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
167169

168-
/// The associated [`miniscript::hash256::Hash`] for this [`MiniscriptKey`], used in the
169-
/// hash256 fragment.
170+
/// The associated [`hash256::Hash`] for this `MiniscriptKey`, used in the hash256 fragment.
171+
///
172+
/// [`hash256::Hash`]: crate::hash256::Hash
170173
type Hash256: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
171174

172-
/// The associated [`bitcoin::hashes::ripemd160::Hash`] for this [`MiniscriptKey`] type, used
173-
/// in the ripemd160 fragment.
175+
/// The associated [`ripemd160::Hash`] for this `MiniscriptKey` type, used in the ripemd160 fragment.
176+
///
177+
/// [`ripemd160::Hash`]: bitcoin::hashes::ripemd160::Hash
174178
type Ripemd160: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
175179

176-
/// The associated [`bitcoin::hashes::hash160::Hash`] for this [`MiniscriptKey`] type, used in
177-
/// the hash160 fragment.
180+
/// The associated [`hash160::Hash`] for this `MiniscriptKey` type, used in the hash160 fragment.
181+
///
182+
/// [`hash160::Hash`]: bitcoin::hashes::hash160::Hash
178183
type Hash160: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
179184
}
180185

0 commit comments

Comments
 (0)