Function optional_parser

Source
pub(crate) fn optional_parser<I, O, E, L>(
    condition: bool,
    element: L,
) -> impl FnMut(I) -> IResult<I, Option<O>, E>
where L: Parser<I, Error = E, Output = O>, E: ParseError<I>, I: Input + Copy + Copy,
Expand description

If the condition is true, this parser only returns Some or None