Skip to main content

parse_qw_words

Function parse_qw_words 

Source
pub fn parse_qw_words(s: &str) -> Option<Vec<String>>
Expand description

Parse a qw(...) expression and return the whitespace-split word list.

This is a convenience wrapper around parse_quote_operator_content that additionally splits the inner content on whitespace. Returns None when the input is not a valid qw expression.

§Examples

assert_eq!(
    parse_qw_words("qw(Foo Bar Baz)"),
    Some(vec!["Foo".to_string(), "Bar".to_string(), "Baz".to_string()])
);
assert_eq!(parse_qw_words("qwfoo"), None);