Trait check_keyword::CheckKeyword

source ·
pub trait CheckKeyword {
    // Required methods
    fn is_keyword(&self) -> bool;
    fn keyword_status(&self) -> KeywordStatus;
    fn into_safe(self) -> String;
}
Expand description

A trait for checking if self is a keyword.

Required Methods§

source

fn is_keyword(&self) -> bool

Check if self is a strict or reserved keyword.

If you want to check weak keywords, use CheckKeyword::keyword_status.

source

fn keyword_status(&self) -> KeywordStatus

Returns a detailed description of the type of keyword.

source

fn into_safe(self) -> String

If it is a keyword, add “r#” to the beginning if possible, or “_” to the end if not.

Implementors§