Skip to content

Commit ae82166

Browse files
committed
debug did same as display
1 parent c477616 commit ae82166

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

crates/xdid-core/src/did.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
use std::{fmt::Display, str::FromStr};
1+
use std::{
2+
fmt::{Debug, Display},
3+
str::FromStr,
4+
};
25

36
use anyhow::bail;
47
use serde::{Deserialize, Serialize};
58
use smol_str::SmolStr;
69

7-
#[derive(Debug, Clone, PartialEq, Eq)]
10+
#[derive(Clone, PartialEq, Eq)]
811
/// A [Decentralized Identifier](https://www.w3.org/TR/did-core/#did-syntax).
912
pub struct Did {
1013
pub method_name: MethodName,
@@ -17,6 +20,12 @@ impl Display for Did {
1720
}
1821
}
1922

23+
impl Debug for Did {
24+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25+
write!(f, "did:{}:{}", self.method_name.0, self.method_id.0)
26+
}
27+
}
28+
2029
impl FromStr for Did {
2130
type Err = anyhow::Error;
2231

0 commit comments

Comments
 (0)