Trait ropey::segmentation::GraphemeSegmenter [] [src]

pub trait GraphemeSegmenter: Debug + Copy + Clone {
    fn seam_is_break(left: &str, right: &str) -> bool;

    fn is_break(byte_idx: usize, text: &str) -> bool { ... }
}

Trait for implementing grapheme segmentation strategies for Rope.

See the documentation of the segmentation module for details.

Required Methods

Returns true if the boundary between the two given strings is a grapheme cluster boundary, and false otherwise.

Ropey only calls this with valid and non-empty left and right strings.

Provided Methods

Returns whether the given byte index in the given string is a grapheme cluster boundary.

Ropey only calls this on valid utf8 code point boundaries, and never on the start or end of the string.

This function's default implementation simply calls seam_is_break(), passing it the text split at char_idx. If you have a more efficient approach, go ahead and implement this manually.

Implementors