mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
chore(vault): implement std::errror::Error on CborConversionError
This commit is contained in:
parent
186e83bf9e
commit
371164b82f
1 changed files with 14 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::fmt::Display;
|
||||||
|
|
||||||
use cbor::{self, cbor_array_vec, cbor_key_int, cbor_map, cbor_unsigned, destructure_cbor_map};
|
use cbor::{self, cbor_array_vec, cbor_key_int, cbor_map, cbor_unsigned, destructure_cbor_map};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
@ -7,6 +9,17 @@ pub enum CborConversionError {
|
||||||
UnknownAlgorithm(u64),
|
UnknownAlgorithm(u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Display for CborConversionError {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
CborConversionError::BadCbor => write!(f, "bad cbor"),
|
||||||
|
CborConversionError::UnknownAlgorithm(algo) => write!(f, "unknown algorithm {}", algo),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::error::Error for CborConversionError {}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub enum HashAlgorithms {
|
pub enum HashAlgorithms {
|
||||||
SHA1,
|
SHA1,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue