1pub mod tariff;
11
12use std::fmt;
13
14use crate::json;
15
16pub(crate) fn tariff(tariff: &crate::tariff::Versioned<'_>) -> Result<tariff::Report, Error> {
18 tariff::lint(tariff)
19}
20
21#[derive(Debug)]
23pub enum Error {
24 Parse(json::Error),
26}
27
28impl From<json::Error> for Error {
29 fn from(err: json::Error) -> Self {
30 Self::Parse(err)
31 }
32}
33
34impl std::error::Error for Error {
35 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
36 None
37 }
38}
39
40impl fmt::Display for Error {
41 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42 match self {
43 Error::Parse(err) => write!(f, "{err}"),
44 }
45 }
46}
47
48#[cfg(test)]
49mod test {
50 use super::Error;
51
52 #[test]
53 const fn error_should_be_send_and_sync() {
54 const fn f<T: Send + Sync>() {}
55
56 f::<Error>();
57 }
58}