ocpi-tariffs 0.55.0

OCPI tariff calculations
Documentation
//! Test support for building a `v211` tariff or CDR.

use super::{Cdr, Tariff};
use crate::{Caveat, json, schema::Warning, warning};

/// Build a `v211` tariff from `doc`, returning it and the walk's warnings in a
/// [`Caveat`].
pub(crate) fn build_tariff<'buf>(doc: &json::Document<'buf>) -> Caveat<Tariff<'buf>, Warning> {
    let mut warnings = warning::Gatherer::new();
    let tariff = super::build_tariff(doc, &mut warnings);
    Caveat::new(tariff, warnings.into_set())
}

/// Build a `v211` CDR from `doc`, returning it and the walk's warnings in a
/// [`Caveat`].
pub(crate) fn build_cdr<'buf>(doc: &json::Document<'buf>) -> Caveat<Cdr<'buf>, Warning> {
    let mut warnings = warning::Gatherer::new();
    let cdr = super::build_cdr(doc, &mut warnings);
    Caveat::new(cdr, warnings.into_set())
}