tiedcrossing_type/digest/
mod.rs1mod algorithm;
5mod algorithms;
6mod digests;
7mod reader;
8mod verifier;
9mod writer;
10
11pub use algorithm::Algorithm;
12pub use algorithms::Algorithms;
13pub use digests::ContentDigest;
14pub use reader::Reader;
15pub use verifier::Verifier;
16pub use writer::Writer;
17
18#[derive(Clone, Debug, PartialEq, Eq)]
20pub enum Error {
21 MissingEq,
22 MissingColons,
23 UnknownAlgorithm,
24 Decode(base64::DecodeError),
25}
26
27impl std::fmt::Display for Error {
28 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29 match self {
30 Self::Decode(e) => e.fmt(f),
31 Self::MissingEq => f.write_str("missing equals"),
32 Self::MissingColons => f.write_str("missing colons"),
33 Self::UnknownAlgorithm => f.write_str("unknown algorithm"),
34 }
35 }
36}
37
38impl std::error::Error for Error {}
39
40impl From<base64::DecodeError> for Error {
41 fn from(value: base64::DecodeError) -> Self {
42 Self::Decode(value)
43 }
44}