JMAP Registry API implementation - part 2
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user