/// Parses the given input line into a Selector or None.
Parses the given input line into a Selector or None.
Parses the given input line into a Selector or None .
pub fn selector_or_comment<'a, E>(input: &'a str) -> Result<Option<Selector<'a>>, ParseError>
where
    E: ParsingError<'a>,
{
    let result = complete(all_consuming(alt((
        map(comment, |_| None),
        map(
            do_parse_selector::<<E as ParsingError<'_>>::Internal>(
                /*allow_inline_comment=*/ true,
            ),
            |s| Some(s),
        ),
    ))))(input);
    match result {
        Ok((_, maybe_selector)) => match maybe_selector {
            None => Ok(None),
            Some(selector) => {
                selector.validate()?;
                Ok(Some(selector))
            }
        },
        Err(nom::Err::Error(e) | nom::Err::Failure(e)) => Err(E::to_error(input, e)),
        _ => unreachable!("through the complete combinator we get rid of Incomplete"),
    }
}
pub fn selector_or_comment < ' a , E > ( input : & ' a str ) -> Result < Option < Selector < ' a > > , ParseError > where E : ParsingError < ' a > , { let result = complete ( all_consuming ( alt ( ( map ( comment , | _ | None ) , map ( do_parse_selector :: < < E as ParsingError < ' _ > > :: Internal > ( /*allow_inline_comment=*/ true , ) , | s | Some ( s ) , ) , ) ) ) ) ( input ) ; match result { Ok ( ( _ , maybe_selector ) ) => match maybe_selector { None => Ok ( None ) , Some ( selector ) => { selector . validate ( ) ? ; Ok ( Some ( selector ) ) } } , Err ( nom :: Err :: Error ( e ) | nom :: Err :: Failure ( e ) ) => Err ( E :: to_error ( input , e ) ) , _ => unreachable ! ( " " ) , } }
Parses the given input line into a Selector or None.
Parses the given input line into a Selector or None .
input
&'a str