Skip to main content

Identifiers

Trait Identifiers 

Source
pub trait Identifiers {
    const KEYWORDS: &'static [&'static str];

    // Required method
    fn escape_keyword(keyword: &str) -> String;

    // Provided method
    fn ident(name: &str) -> String { ... }
}
Expand description

The language’s names: its reserved words, and how a name spelled like one is made an identifier.

Required Associated Constants§

Source

const KEYWORDS: &'static [&'static str]

The reserved words.

Required Methods§

Source

fn escape_keyword(keyword: &str) -> String

keyword made an identifier.

Provided Methods§

Source

fn ident(name: &str) -> String

name as an identifier: escaped when it’s a reserved word.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§