Skip to content

Commit 0197c3e

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 a280447 commit 0197c3e

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
@@ -148,34 +148,39 @@ pub use crate::miniscript::satisfy::{Preimage32, Satisfier};
148148
pub use crate::miniscript::{hash256, Miniscript};
149149
use crate::prelude::*;
150150

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)