Improve documentation around EcdsaSig

Improve the rustdocs for serialization methods of the `EcdsaSig` type.
This commit is contained in:
Tobin Harding 2022-01-07 13:58:47 +11:00 committed by Tobin C. Harding
parent 50d9394582
commit e6084a1af8
1 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ pub struct EcdsaSig {
} }
impl EcdsaSig { impl EcdsaSig {
/// Constructs ECDSA bitcoin signature for [`EcdsaSighashType::All`] /// Constructs an ECDSA bitcoin signature for [`EcdsaSighashType::All`].
pub fn sighash_all(sig: secp256k1::ecdsa::Signature) -> EcdsaSig { pub fn sighash_all(sig: secp256k1::ecdsa::Signature) -> EcdsaSig {
EcdsaSig { EcdsaSig {
sig, sig,
@ -43,7 +43,7 @@ impl EcdsaSig {
} }
} }
/// Deserialize from slice following the standardness rules for [`EcdsaSighashType`] /// Deserializes from slice following the standardness rules for [`EcdsaSighashType`].
pub fn from_slice(sl: &[u8]) -> Result<Self, EcdsaSigError> { pub fn from_slice(sl: &[u8]) -> Result<Self, EcdsaSigError> {
let (hash_ty, sig) = sl.split_last() let (hash_ty, sig) = sl.split_last()
.ok_or(EcdsaSigError::EmptySignature)?; .ok_or(EcdsaSigError::EmptySignature)?;
@ -54,7 +54,7 @@ impl EcdsaSig {
Ok(EcdsaSig { sig, hash_ty }) Ok(EcdsaSig { sig, hash_ty })
} }
/// Serialize EcdsaSig /// Serializes an ECDSA signature (inner secp256k1 signature in DER format).
pub fn to_vec(&self) -> Vec<u8> { pub fn to_vec(&self) -> Vec<u8> {
// TODO: add support to serialize to a writer to SerializedSig // TODO: add support to serialize to a writer to SerializedSig
self.sig.serialize_der() self.sig.serialize_der()