[−][src]Struct rspell::Spell
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,