Skip to content

Commit d8fb367

Browse files
committed
Improve rustdocs on ToPublicKey
Clean up the `ToPublicKey` trait docs. Note this leaves the links to the hash types in there since they are the return type.
1 parent a8d5938 commit d8fb367

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,38 +207,38 @@ impl MiniscriptKey for String {
207207
type Hash160 = String;
208208
}
209209

210-
/// Trait describing public key types which can be converted to bitcoin pubkeys
210+
/// Trait describing key types that can be converted to bitcoin public keys.
211211
pub trait ToPublicKey: MiniscriptKey {
212-
/// Converts an object to a public key
212+
/// Converts key to a public key.
213213
fn to_public_key(&self) -> bitcoin::PublicKey;
214214

215-
/// Convert an object to x-only pubkey
215+
/// Converts key to an x-only public key.
216216
fn to_x_only_pubkey(&self) -> bitcoin::secp256k1::XOnlyPublicKey {
217217
let pk = self.to_public_key();
218218
bitcoin::secp256k1::XOnlyPublicKey::from(pk.inner)
219219
}
220220

221-
/// Obtain the public key hash for this MiniscriptKey
222-
/// Expects an argument to specify the signature type.
223-
/// This would determine whether to serialize the key as 32 byte x-only pubkey
224-
/// or regular public key when computing the hash160
221+
/// Obtains the pubkey hash for this key (as a `MiniscriptKey`).
222+
///
223+
/// Expects an argument to specify the signature type. This determines whether to serialize
224+
/// the key as 32 byte x-only pubkey or regular public key when computing the hash160.
225225
fn to_pubkeyhash(&self, sig_type: SigType) -> hash160::Hash {
226226
match sig_type {
227227
SigType::Ecdsa => hash160::Hash::hash(&self.to_public_key().to_bytes()),
228228
SigType::Schnorr => hash160::Hash::hash(&self.to_x_only_pubkey().serialize()),
229229
}
230230
}
231231

232-
/// Converts the generic associated [`MiniscriptKey::Sha256`] to [`sha256::Hash`]
232+
/// Converts the associated [`MiniscriptKey::Sha256`] type to a [`sha256::Hash`].
233233
fn to_sha256(hash: &<Self as MiniscriptKey>::Sha256) -> sha256::Hash;
234234

235-
/// Converts the generic associated [`MiniscriptKey::Hash256`] to [`hash256::Hash`]
235+
/// Converts the associated [`MiniscriptKey::Hash256`] type to a [`hash256::Hash`].
236236
fn to_hash256(hash: &<Self as MiniscriptKey>::Hash256) -> hash256::Hash;
237237

238-
/// Converts the generic associated [`MiniscriptKey::Ripemd160`] to [`ripemd160::Hash`]
238+
/// Converts the associated [`MiniscriptKey::Ripemd160`] type to a [`ripemd160::Hash`].
239239
fn to_ripemd160(hash: &<Self as MiniscriptKey>::Ripemd160) -> ripemd160::Hash;
240240

241-
/// Converts the generic associated [`MiniscriptKey::Hash160`] to [`hash160::Hash`]
241+
/// Converts the associated [`MiniscriptKey::Hash160`] type to a [`hash160::Hash`].
242242
fn to_hash160(hash: &<Self as MiniscriptKey>::Hash160) -> hash160::Hash;
243243
}
244244

0 commit comments

Comments
 (0)