Skip to content

Commit cb1344d

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 - Don't link to hashes types
1 parent f47cfd9 commit cb1344d

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/lib.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,34 +147,31 @@ 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.
166166
type Sha256: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
167167

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

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

176-
/// The associated [`bitcoin::hashes::hash160::Hash`] for this [`MiniscriptKey`] type, used in
177-
/// the hash160 fragment.
174+
/// The associated `hash160::Hash` for this `MiniscriptKey` type, used in the hash160 fragment.
178175
type Hash160: Clone + Eq + Ord + fmt::Display + fmt::Debug + hash::Hash;
179176
}
180177

0 commit comments

Comments
 (0)