Skip to content

Commit f250438

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 foramt
1 parent 730c492 commit f250438

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/lib.rs

+18-13
Original file line numberDiff line numberDiff line change
@@ -153,34 +153,39 @@ use crate::prelude::*;
153153
pub use crate::primitives::absolute_locktime::{AbsLockTime, AbsLockTimeError};
154154
pub use crate::primitives::relative_locktime::{RelLockTime, RelLockTimeError};
155155

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

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

166-
/// Returns the number of different derivation paths in this key. Only >1 for keys
167-
/// in BIP389 multipath descriptors.
166+
/// Returns the number of different derivation paths in this key, defaults to `0`.
167+
///
168+
/// Only >1 for keys in BIP389 multipath descriptors.
168169
fn num_der_paths(&self) -> usize { 0 }
169170

170-
/// The associated [`bitcoin::hashes::sha256::Hash`] for this [`MiniscriptKey`], used in the
171-
/// sha256 fragment.
171+
/// The associated [`sha256::Hash`] for this `MiniscriptKey`, used in the sha256 fragment.
172+
///
173+
/// [`sha256::Hash`]: bitcoin::hashes::sha256::Hash
172174
type Sha256: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
173175

174-
/// The associated [`miniscript::hash256::Hash`] for this [`MiniscriptKey`], used in the
175-
/// hash256 fragment.
176+
/// The associated [`hash256::Hash`] for this `MiniscriptKey`, used in the hash256 fragment.
177+
///
178+
/// [`hash256::Hash`]: crate::hash256::Hash
176179
type Hash256: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
177180

178-
/// The associated [`bitcoin::hashes::ripemd160::Hash`] for this [`MiniscriptKey`] type, used
179-
/// in the ripemd160 fragment.
181+
/// The associated [`ripemd160::Hash`] for this `MiniscriptKey` type, used in the ripemd160 fragment.
182+
///
183+
/// [`ripemd160::Hash`]: bitcoin::hashes::ripemd160::Hash
180184
type Ripemd160: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
181185

182-
/// The associated [`bitcoin::hashes::hash160::Hash`] for this [`MiniscriptKey`] type, used in
183-
/// the hash160 fragment.
186+
/// The associated [`hash160::Hash`] for this `MiniscriptKey` type, used in the hash160 fragment.
187+
///
188+
/// [`hash160::Hash`]: bitcoin::hashes::hash160::Hash
184189
type Hash160: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
185190
}
186191

0 commit comments

Comments
 (0)