[][src]Struct ispell::SpellLauncher

pub struct SpellLauncher { /* fields omitted */ }

Spell Launcher wizard (ah, ah). A builder for SpellChecker.

Runs ispell or one of its variant.

Examples

  • Launches ispell with british dictionary:
use ispell::SpellLauncher;
let checker = SpellLauncher::new()
              .dictionary("british")
              .launch()
              .unwrap();
  • Launches aspell with french (France) language:
use ispell::SpellLauncher;
let checker = SpellLauncher::new()
              .aspell()
              .dictionary("fr_FR")
              .launch()
              .unwrap();

Implementations

impl SpellLauncher[src]

pub fn new() -> SpellLauncher[src]

Creates a new spell checker with default options

pub fn aspell(&mut self) -> &mut SpellLauncher[src]

Sets mode to aspell instead of ispell.

Will run aspell as the command if it is not set

pub fn hunspell(&mut self) -> &mut SpellLauncher[src]

Sets compatibility mode to hunspell instead of ispell.

Will run hunspell as the command if it is not set

pub fn ispell(&mut self) -> &mut SpellLauncher[src]

Sets compatibility mode to ispell

Will run ispell as the command if it is not set (default setting)

pub fn timeout(&mut self, timeout: u64) -> &mut SpellLauncher[src]

Sets the timeout when checking ispell

If the spawned process takes longer than this timeout to answer to a query, it will be killed and an error will be returned, preventing your program from freezing indefinitely.

The timeout is set in milliseconds, and is 1000 (a second) by default.

pub fn command<S: Into<String>>(&mut self, command: S) -> &mut SpellLauncher[src]

Set the name of the command to run

By default, it inferred from the mode (which is ispell by default).

Unless you want to run a specific (ispell-compatible) command, you shouldn't use this method directly, but rather use the aspell or hunspell methods, since this also allow the the library to know which actual program is runned and to set encoding options accordingly.

pub fn dictionary<S: Into<String>>(&mut self, lang: S) -> &mut SpellLauncher[src]

Determine the dictionary that should be used.

Note that ispell, hunspell and aspell have different naming schemes:

  • ispell accepts full names, e.g. "american", "british", "french", ...
  • hunspell accepts unicode language codes, e.g. "fr_FR", "en_GB", ...
  • aspell accepts both.

Example

use ispell::SpellLauncher;
let checker = SpellLauncher::new()
              .aspell()
              .dictionary("en_GB")
              .launch()
              .unwrap();

pub fn launch(&self) -> Result<SpellChecker>[src]

Launch ispell (or aspell or hunspell) and return a SpellChecker

Trait Implementations

impl Debug for SpellLauncher[src]

Auto Trait Implementations

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.