We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ee5db69 + c0f3448 commit f26efc5Copy full SHA for f26efc5
backup-shard/src/lib.rs
@@ -39,4 +39,14 @@ impl Shard {
39
hash_input.extend_from_slice(self.data().as_slice());
40
hash_input
41
}
42
+
43
+ /// Returns the encoded shard (official encoding is minicbor)
44
+ pub fn encode(&self) -> Vec<u8> {
45
+ minicbor::to_vec(self).unwrap()
46
+ }
47
48
+ /// Returns the decoded shard (official encoding is minicbor)
49
+ pub fn decode(data: &[u8]) -> Result<Shard, minicbor::decode::Error> {
50
+ minicbor::decode(data)
51
52
0 commit comments