Skip to main content

is_python_reserved_word

Function is_python_reserved_word 

Source
pub fn is_python_reserved_word(input: &str) -> bool
Expand description

Returns whether input is either a hard or soft Python reserved word.

Examples found in repository?
examples/basic_usage.rs (line 9)
3fn main() -> Result<(), use_python_keyword::PythonKeywordParseError> {
4    let keyword: PythonKeyword = "async".parse()?;
5    let soft_keyword: PythonSoftKeyword = "match".parse()?;
6
7    assert_eq!(keyword.to_string(), "async");
8    assert_eq!(soft_keyword.as_str(), "match");
9    assert!(is_python_reserved_word("case"));
10    Ok(())
11}