Skip to main content

python_keyword_basic_usage/
basic_usage.rs

1use use_python_keyword::{PythonKeyword, PythonSoftKeyword, is_python_reserved_word};
2
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}