Skip to main content

SpellChecker

Trait SpellChecker 

Source
pub trait SpellChecker {
    // Required methods
    fn misspelled_words(&self, text: &str, cx: &App) -> Vec<Range<usize>>;
    fn guesses(&self, word: &str, cx: &App) -> Vec<SharedString>;
    fn learn(&self, word: &str, cx: &mut App);
}
Expand description

What tells an input’s words spelled right from wrong: the platform’s spell checker, a dictionary the app ships, or anything else that can.

Give one to an input with InputBaseState::spell_checker. An input without one checks nothing.

Required Methods§

Source

fn misspelled_words(&self, text: &str, cx: &App) -> Vec<Range<usize>>

The UTF-8 byte ranges of the words in text that are misspelled, in order.

Source

fn guesses(&self, word: &str, cx: &App) -> Vec<SharedString>

What word may have been meant to be, best first.

Source

fn learn(&self, word: &str, cx: &mut App)

Accept word as spelled right from now on.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§