#![allow(clippy::all, unused_qualifications)]
pub mod protocol {
include!(concat!(env!("OUT_DIR"), "/warg.protocol.rs"));
include!(concat!(env!("OUT_DIR"), "/warg.protocol.serde.rs"));
}
pub mod transparency {
use anyhow::Error;
use warg_crypto::hash::{Hash, SupportedDigest};
include!(concat!(env!("OUT_DIR"), "/warg.transparency.rs"));
include!(concat!(env!("OUT_DIR"), "/warg.transparency.serde.rs"));
impl<D> From<Option<Hash<D>>> for OptionalHash
where
D: SupportedDigest,
{
fn from(value: Option<Hash<D>>) -> Self {
Self {
hash: value.map(|h| h.bytes().to_vec()),
}
}
}
impl<D> TryFrom<OptionalHash> for Option<Hash<D>>
where
D: SupportedDigest,
{
type Error = Error;
fn try_from(value: OptionalHash) -> Result<Self, Self::Error> {
let hash = match value.hash {
Some(h) => Some(h.try_into()?),
None => None,
};
Ok(hash)
}
}
}
pub mod internal {
include!(concat!(env!("OUT_DIR"), "/warg.internal.rs"));
include!(concat!(env!("OUT_DIR"), "/warg.internal.serde.rs"));
}