sudachi::input_text

Trait InputTextIndex

source
pub trait InputTextIndex {
    // Required methods
    fn cat_of_range(&self, range: Range<usize>) -> CategoryType;
    fn cat_at_char(&self, offset: usize) -> CategoryType;
    fn cat_continuous_len(&self, offset: usize) -> usize;
    fn char_distance(&self, index: usize, offset: usize) -> usize;
    fn orig_slice(&self, range: Range<usize>) -> &str;
    fn curr_slice(&self, range: Range<usize>) -> &str;
    fn to_orig(&self, range: Range<usize>) -> Range<usize>;
}
Expand description

Provides fast indexed access into the input text

Required Methods§

source

fn cat_of_range(&self, range: Range<usize>) -> CategoryType

Common character category inside the range. Indexed by chars.

source

fn cat_at_char(&self, offset: usize) -> CategoryType

Character category at char offset

source

fn cat_continuous_len(&self, offset: usize) -> usize

Number of chars to the right of the offset with the same character category

Java name: getCharCategoryContinuousLength

source

fn char_distance(&self, index: usize, offset: usize) -> usize

Distance in chars between the char indexed by index and the char, relative to it by offset. Java name: getCodePointsOffsetLength

source

fn orig_slice(&self, range: Range<usize>) -> &str

Returns substring of original text by indices from the current text

source

fn curr_slice(&self, range: Range<usize>) -> &str

Returns substring of the current (modified) text by indices from the current text

source

fn to_orig(&self, range: Range<usize>) -> Range<usize>

Translate range from current state to original. Byte-indexed.

Implementors§