parse_freshness_def

Function parse_freshness_def 

Source
fn parse_freshness_def(
    config: FreshnessConfig,
) -> Result<FreshnessDef, ConfigError>
Expand description

Convert a freshness configuration into its AST representation.

§Returns

Ok(FreshnessDef::BestEffort { max_staleness }) when the input is BestEffort, Ok(FreshnessDef::Strict) when the input is Strict.

§Examples

let cfg = FreshnessConfig::BestEffort { max_staleness: "5m".into() };
let def = parse_freshness_def(cfg).unwrap();
match def {
    FreshnessDef::BestEffort { max_staleness } => assert_eq!(max_staleness, "5m"),
    _ => panic!("unexpected variant"),
}