Trait UnicodeBrackets

Source
pub trait UnicodeBrackets {
    // Required methods
    fn is_open_bracket(&self) -> bool;
    fn is_close_bracket(&self) -> bool;
    fn to_open_bracket(&self) -> Self;
    fn to_close_bracket(&self) -> Self;
}
Expand description

Methods for determining whether a character is an opening or closing bracket and for changing the direction of such characters.

The definitions used in this crate are from the unicode bidirectional algorithm (UAX #9). Specifically, see the file http://www.unicode.org/Public/UCD/latest/ucd/BidiBrackets.txt

Required Methods§

Source

fn is_open_bracket(&self) -> bool

Determine whether a character is an opening bracket.

Source

fn is_close_bracket(&self) -> bool

Determine whether a character is a closing bracket.

Source

fn to_open_bracket(&self) -> Self

Convert a closing bracket character to an opening bracket. Returns self if the character is not a closing bracket.

Source

fn to_close_bracket(&self) -> Self

Convert an opening bracket character to a closing bracket. Returns self if the character is not an opening bracket.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl UnicodeBrackets for char

Implementors§