src/backup/manifest.rs: impl TryFrom DataBlob
This commit is contained in:
parent
7759eef552
commit
247a8ca5bb
@ -100,6 +100,17 @@ impl BackupManifest {
|
||||
}
|
||||
|
||||
}
|
||||
impl TryFrom<super::DataBlob> for BackupManifest {
|
||||
type Error = Error;
|
||||
|
||||
fn try_from(blob: super::DataBlob) -> Result<Self, Error> {
|
||||
let data = blob.decode(None)
|
||||
.map_err(|err| format_err!("decode backup manifest blob failed - {}", err))?;
|
||||
let json: Value = serde_json::from_slice(&data[..])
|
||||
.map_err(|err| format_err!("unable to parse backup manifest json - {}", err))?;
|
||||
BackupManifest::try_from(json)
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<Value> for BackupManifest {
|
||||
type Error = Error;
|
||||
|
Loading…
Reference in New Issue
Block a user