Trait unicode_bidi::data_source::BidiDataSource

source ·
pub trait BidiDataSource {
    // Required method
    fn bidi_class(&self, c: char) -> BidiClass;

    // Provided method
    fn bidi_matched_opening_bracket(
        &self,
        c: char,
    ) -> Option<BidiMatchedOpeningBracket> { ... }
}
Expand description

This trait abstracts over a data source that is able to produce the Unicode Bidi class for a given character

Required Methods§

Provided Methods§

source

fn bidi_matched_opening_bracket( &self, c: char, ) -> Option<BidiMatchedOpeningBracket>

If this character is a bracket according to BidiBrackets.txt, return the corresponding normalized opening bracket of the pair, and whether or not it itself is an opening bracket.

This effectively buckets brackets into equivalence classes keyed on the normalized opening bracket.

The default implementation will pull in a small amount of hardcoded data, regardless of the hardcoded-data feature. This is in part for convenience (since this data is small and changes less often), and in part so that this method can be added without needing a breaking version bump. Override this method in your custom data source to prevent the use of hardcoded data.

Implementors§