1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with // this file, You can obtain one at https://mozilla.org/MPL/2.0/. /// An ispell error, corresponding to a word that isn't in the dictonary. #[derive(Debug, PartialEq)] pub struct IspellError { /// The misspelled word pub misspelled: String, /// The position of the word /// (number of characters since the beginning of the new line) pub position: usize, /// A list of suggestions pub suggestions: Vec<String>, } /// A result from ispell, corresponding to a line that is sent back for each word. /// /// See the manpage `ispell(1)` for more informations about the meaning of each variant. #[derive(Debug, PartialEq)] pub enum IspellResult { /// The word was found in the dictionnary. /// /// Corresponds to '*' Ok, /// The word wasn't found, but a root word was found. /// /// Corresponds to '+' Root(String), /// The word wasn't found, but corresponds to the concatenation of two words /// /// Corresponds to '-' Compound, /// The word wasn't found, but there are near misses /// /// Corresponds to '&' Miss(IspellError), /// The word wasn't found, but could be formed by adding illegal affixes to a known root /// /// Corresponds to '?' Guess(IspellError), /// The word wasn't found in the dictionnary and there are no suggestions /// /// Corresponds to '#' None(IspellError), }