pub fn optional<A, I: Clone>(mut parser: impl Parser<A, I>) -> impl Parser<Option<A>, I> {
    move |input: I| {
        if let Some((value, input)) = parser.parse(input.clone()) {
            Some((Some(value), input))
        } else {
            Some((None, input))
        }
    }
}
/// Tries to apply a parser, but fails gracefully (with an `Option` output).
Tries to apply a parser, but fails gracefully (with an `Option` output).
Tries to apply a parser but fails gracefully ( with an ` Option ` output ) .
pub fn optional<A, I: Clone>(mut parser: impl Parser<A, I>) -> impl Parser<Option<A>, I> {
    move |input: I| {
        if let Some((value, input)) = parser.parse(input.clone()) {
            Some((Some(value), input))
        } else {
            Some((None, input))
        }
    }
}
pub fn optional < A , I : Clone > ( mut parser : impl Parser < A , I > ) -> impl Parser < Option < A > , I > { move | input : I | { if let Some ( ( value , input ) ) = parser . parse ( input . clone ( ) ) { Some ( ( Some ( value ) , input ) ) } else { Some ( ( None , input ) ) } } }
Tries to apply a parser, but fails gracefully (with an `Option` output).
Tries to apply a parser but fails gracefully ( with an ` Option ` output ) .
parser
impl Parser<A, I>