Skip to main content

CharExt

Trait CharExt 

Source
pub trait CharExt {
    // Required methods
    fn is_identifier_start(&self) -> bool;
    fn is_identifier_continue(&self) -> bool;
}
Expand description

Extension methods for char.

These methods assume that all identifiers are ASCII. This is not actually the case for Rust, which identifiers follow the specification in Unicode Standard Annex #31. We intend to implement this properly in the future, but doing so requires generating several large Unicode character tables, which why we’ve held off from this for now.

Required Methods§

Source

fn is_identifier_start(&self) -> bool

Checks if char is the start of an identifier.

Source

fn is_identifier_continue(&self) -> bool

Checks if char is the continuation of an identifier.

Note that this method assumes all identifiers are ASCII.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl CharExt for char

Implementors§