JMAP Registry API implementation - part 2

This commit is contained in:
mdecimus
2026-02-24 17:19:44 +01:00
parent ec148c5550
commit 2fea9a46b0
61 changed files with 1746 additions and 1992 deletions

View File

@@ -222,6 +222,10 @@ impl BlobId {
0
}
}
pub fn is_empty(&self) -> bool {
self.hash.is_empty()
}
}
impl serde::Serialize for BlobId {
@@ -233,6 +237,16 @@ impl serde::Serialize for BlobId {
}
}
impl<'de> serde::Deserialize<'de> for BlobId {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
BlobId::from_str(<&str>::deserialize(deserializer)?)
.map_err(|_| serde::de::Error::custom("invalid BlobId"))
}
}
impl std::fmt::Display for BlobId {
#[allow(clippy::unused_io_amount)]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {