#[derive(Debug)]
pub enum FromStrError {}
#[derive(Debug, PartialEq, Clone, Eq, Hash)]
pub struct Digest(String);
impl std::fmt::Display for FromStrError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("invalid digest")
}
}
impl std::error::Error for FromStrError {}
impl std::fmt::Display for Digest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl std::str::FromStr for Digest {
type Err = FromStrError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self(s.to_string()))
}
}