pub struct SpellChecker {}Expand description
A handle to the host OS spell-checking service.
Implementations§
Source§impl SpellChecker
impl SpellChecker
Sourcepub fn new() -> Self
pub fn new() -> Self
Connect to the system spell checker. Always succeeds; on an unsupported platform — or if the OS service can’t be reached — the methods below just return empty results.
Sourcepub fn check(&self, text: &str) -> Vec<Range<usize>>
pub fn check(&self, text: &str) -> Vec<Range<usize>>
Find the misspelled words in text, returning their UTF-8 byte ranges
(so &text[range] is the offending word). Cheap enough to run on edit.
Call on the main thread: the macOS backend talks to AppKit.
Sourcepub fn suggestions(&self, word: &str) -> Vec<String>
pub fn suggestions(&self, word: &str) -> Vec<String>
Suggested replacements for a single (presumably misspelled) word, best
first. Potentially slow (a system spell-service round-trip on macOS) —
call it lazily, for one word at a time, not across a whole document.
Call on the main thread.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpellChecker
impl RefUnwindSafe for SpellChecker
impl Send for SpellChecker
impl Sync for SpellChecker
impl Unpin for SpellChecker
impl UnsafeUnpin for SpellChecker
impl UnwindSafe for SpellChecker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more