add Debug impl to context object

This commit is contained in:
Andrew Poelstra 2018-08-12 15:20:31 +00:00
parent fa670a0c2a
commit 83c7b6d9b7
1 changed files with 24 additions and 0 deletions

View File

@ -449,6 +449,30 @@ impl<C> Drop for Secp256k1<C> {
}
}
impl fmt::Debug for Secp256k1<None> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<secp256k1 context {:?}, no capabilities>", self.ctx)
}
}
impl fmt::Debug for Secp256k1<SignOnly> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<secp256k1 context {:?}, signing only>", self.ctx)
}
}
impl fmt::Debug for Secp256k1<VerifyOnly> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<secp256k1 context {:?}, verification only>", self.ctx)
}
}
impl fmt::Debug for Secp256k1<All> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "<secp256k1 context {:?}, all capabilities>", self.ctx)
}
}
impl Secp256k1<None> {
/// Creates a new Secp256k1 context with no capabilities (just de/serialization)
pub fn without_caps() -> Secp256k1<None> {