Convert all functions to using the wrapped input type.
This commit is contained in:
@@ -4,6 +4,7 @@ use nom::character::complete::space0;
|
||||
use nom::combinator::recognize;
|
||||
use nom::sequence::tuple;
|
||||
|
||||
use super::org_source::OrgSource;
|
||||
use super::Context;
|
||||
use crate::error::Res;
|
||||
use crate::parser::parser_with_context::parser_with_context;
|
||||
@@ -12,8 +13,8 @@ use crate::parser::StatisticsCookie;
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
pub fn statistics_cookie<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: &'s str,
|
||||
) -> Res<&'s str, StatisticsCookie<'s>> {
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, StatisticsCookie<'s>> {
|
||||
alt((
|
||||
parser_with_context!(percent_statistics_cookie)(context),
|
||||
parser_with_context!(fraction_statistics_cookie)(context),
|
||||
@@ -23,19 +24,24 @@ pub fn statistics_cookie<'r, 's>(
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
pub fn percent_statistics_cookie<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: &'s str,
|
||||
) -> Res<&'s str, StatisticsCookie<'s>> {
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, StatisticsCookie<'s>> {
|
||||
let (remaining, source) =
|
||||
recognize(tuple((tag("["), nom::character::complete::u64, tag("%]"))))(input)?;
|
||||
let (remaining, _) = space0(remaining)?;
|
||||
Ok((remaining, StatisticsCookie { source }))
|
||||
Ok((
|
||||
remaining,
|
||||
StatisticsCookie {
|
||||
source: source.into(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
pub fn fraction_statistics_cookie<'r, 's>(
|
||||
context: Context<'r, 's>,
|
||||
input: &'s str,
|
||||
) -> Res<&'s str, StatisticsCookie<'s>> {
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, StatisticsCookie<'s>> {
|
||||
let (remaining, source) = recognize(tuple((
|
||||
tag("["),
|
||||
nom::character::complete::u64,
|
||||
@@ -44,5 +50,10 @@ pub fn fraction_statistics_cookie<'r, 's>(
|
||||
tag("]"),
|
||||
)))(input)?;
|
||||
let (remaining, _) = space0(remaining)?;
|
||||
Ok((remaining, StatisticsCookie { source }))
|
||||
Ok((
|
||||
remaining,
|
||||
StatisticsCookie {
|
||||
source: source.into(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user