1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use identity_core::diff::Diff;
use identity_core::diff::DiffString;
use crate::did::IotaDID;
impl Diff for IotaDID {
type Type = DiffString;
fn diff(&self, other: &Self) -> identity_core::diff::Result<Self::Type> {
self.to_string().diff(&other.to_string())
}
fn merge(&self, diff: Self::Type) -> identity_core::diff::Result<Self> {
self
.to_string()
.merge(diff)
.and_then(|this| Self::parse(&this).map_err(identity_core::diff::Error::merge))
}
fn from_diff(diff: Self::Type) -> identity_core::diff::Result<Self> {
String::from_diff(diff).and_then(|this| Self::parse(&this).map_err(identity_core::diff::Error::convert))
}
fn into_diff(self) -> identity_core::diff::Result<Self::Type> {
self.to_string().into_diff()
}
}