[][src]Struct rspell::Spell

pub struct Spell { /* fields omitted */ }

This is the main structure. It allows to gather dictionaries for a given language and spellcheck individual word or whole text using it.

Examples

let spell = rspell::Spell::new("en_US").unwrap();

assert!(!spell.check_word("colour").correct());
assert!(spell.check_word("color").correct());

for bad in spell.check("Wht color is this flg?") {
    println!(
        "{} (offset: {}): possible corrections: {:?}",
        bad.word, bad.offset, bad.suggestions
    );
}

Methods

impl Spell[src]

pub fn new(lang: &str) -> Result<Spell, SpellError>[src]

Creates a new spellchecker for the given language code.

This function will also ensure that data files for the language are available. If not it will try to get it using a LangProvider.

pub fn check_word(&self, word: &str) -> SpellResult[src]

Checks spelling for the given word.

pub fn check<'a>(&self, text: &'a str) -> Vec<BadWord<'a>>[src]

Checks spelling for the given text.

Word boundaries are determined using unicode segmentation rules.

Auto Trait Implementations

impl RefUnwindSafe for Spell

impl !Send for Spell

impl !Sync for Spell

impl Unpin for Spell

impl UnwindSafe for Spell

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.