Compare statistics cookies properties.

This commit is contained in:
Tom Alexander
2023-10-09 19:40:13 -04:00
parent c49455e9ce
commit 4d88256394
3 changed files with 43 additions and 8 deletions

View File

@@ -12,7 +12,10 @@ use crate::context::RefContext;
use crate::error::Res;
use crate::types::StatisticsCookie;
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug", skip(context)))]
#[cfg_attr(
feature = "tracing",
tracing::instrument(ret, level = "debug", skip(context))
)]
pub(crate) fn statistics_cookie<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
@@ -23,7 +26,10 @@ pub(crate) fn statistics_cookie<'b, 'g, 'r, 's>(
))(input)
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug", skip(context)))]
#[cfg_attr(
feature = "tracing",
tracing::instrument(ret, level = "debug", skip(context))
)]
fn percent_statistics_cookie<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
@@ -33,6 +39,7 @@ fn percent_statistics_cookie<'b, 'g, 'r, 's>(
opt(nom::character::complete::u64),
tag("%]"),
)))(input)?;
let value = get_consumed(input, remaining);
let (remaining, _trailing_whitespace) =
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining);
@@ -40,11 +47,15 @@ fn percent_statistics_cookie<'b, 'g, 'r, 's>(
remaining,
StatisticsCookie {
source: source.into(),
value: value.into(),
},
))
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug", skip(context)))]
#[cfg_attr(
feature = "tracing",
tracing::instrument(ret, level = "debug", skip(context))
)]
fn fraction_statistics_cookie<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
@@ -56,6 +67,7 @@ fn fraction_statistics_cookie<'b, 'g, 'r, 's>(
opt(nom::character::complete::u64),
tag("]"),
)))(input)?;
let value = get_consumed(input, remaining);
let (remaining, _trailing_whitespace) =
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
let source = get_consumed(input, remaining);
@@ -63,6 +75,7 @@ fn fraction_statistics_cookie<'b, 'g, 'r, 's>(
remaining,
StatisticsCookie {
source: source.into(),
value: value.into(),
},
))
}