Trait check_keyword::CheckKeyword[][src]

pub trait CheckKeyword<T> {
    fn is_keyword(&self) -> bool;
fn into_safe(self) -> T; }
Expand description

The main trait.

The generic argument T is the output type of into_safe, and in the blanket implementation is equal to Self. I would have used an associated type, but I ran into the good-old “upstream crates may add new impl of trait” error when implementing str.

Required methods

Checks if self is a keyword.

If its a keyword, add “r#” to the beginning.

This function consumes self, so that if it is not a keyword, it can return quickly without cloning. If you want to keep ownership of the original data, clone it first.

Implementations on Foreign Types

Implementors