pub mod tariff;
use std::fmt;
use crate::json;
pub fn tariff(tariff: &crate::tariff::Versioned<'_>) -> Result<tariff::Report, Error> {
tariff::lint(tariff)
}
#[derive(Debug)]
pub enum Error {
Parse(json::Error),
}
impl From<json::Error> for Error {
fn from(err: json::Error) -> Self {
Self::Parse(err)
}
}
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
None
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Parse(err) => write!(f, "{err}"),
}
}
}
#[cfg(test)]
mod test {
use super::Error;
#[test]
const fn error_should_be_send_and_sync() {
const fn f<T: Send + Sync>() {}
f::<Error>();
}
}