use std::fmt;
use std::str::FromStr;
use serde::{Deserialize, Serialize};
pub const FINGERPRINT_VERSION: u32 = 1;
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[serde(transparent)]
pub struct VerdictFingerprint(String);
impl VerdictFingerprint {
#[must_use]
pub fn new(hex: impl Into<String>) -> Self {
Self(hex.into())
}
#[must_use]
pub fn as_str(&self) -> &str {
&self.0
}
#[must_use]
pub fn into_inner(self) -> String {
self.0
}
}
impl AsRef<str> for VerdictFingerprint {
fn as_ref(&self) -> &str {
&self.0
}
}
impl fmt::Display for VerdictFingerprint {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.0)
}
}
impl FromStr for VerdictFingerprint {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self(s.to_owned()))
}
}