Skip to main content

read_keyword

Function read_keyword 

Source
pub fn read_keyword(keywords: &[&str]) -> Result<Option<String>>
Expand description

Match the input against a set of keywords; Similar to readMatch, but the keywords are strings, and Case and catcodes are ignored; additionally, leading spaces are skipped. AND, macros are expanded.

Perf: zero-allocation char-wise comparison against each keyword. The previous version allocated two Strings per char-match (via to_uppercase() and char::to_string()), which was expensive in hot parameter parsing loops.