From 17c1b69757437e0735c4c04739341868474dbac9 Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Mon, 19 Dec 2022 14:21:31 +0100 Subject: [PATCH] Minor improvments --- Cargo.lock | 2 +- src/lib.rs | 8 ++++---- src/server.rs | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed0e878..418d039 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -349,7 +349,7 @@ dependencies = [ [[package]] name = "grammalecte_client" -version = "0.1.0" +version = "0.1.1" dependencies = [ "env_logger", "log", diff --git a/src/lib.rs b/src/lib.rs index 1f26d4b..303232f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -270,7 +270,7 @@ pub struct GrammarError { #[serde(rename = "sType")] pub rule_type: String, #[serde(rename = "aColor")] - pub rule_underline_color: Vec, + pub rule_underline_color: Option>, #[serde(rename = "sMessage")] pub message: String, #[serde(rename = "aSuggestions")] @@ -342,14 +342,14 @@ impl GrammalecteClient { /// Run spell check on text pub async fn spell_check(&self, text: &str) -> Result> { - self.spell_check_with_options(text, HashMap::new()).await + self.spell_check_with_options(text, &HashMap::new()).await } /// Run spell check with custom options pub async fn spell_check_with_options( &self, text: &str, - options: HashMap, + options: &HashMap, ) -> Result> { let url = format!("{}/gc_text/fr", self.base_url); log::debug!("Will use URL {} for spell check", url); @@ -421,7 +421,7 @@ mod test { opts.insert(GramOpt::EspacesInsecables, false); let res = GrammalecteClient::start_server() .unwrap() - .spell_check_with_options(msg, opts) + .spell_check_with_options(msg, &opts) .await .unwrap(); println!("RESULT = {:#?}", res); diff --git a/src/server.rs b/src/server.rs index 01b75f1..5305225 100644 --- a/src/server.rs +++ b/src/server.rs @@ -50,6 +50,7 @@ impl EmbeddedServer { .arg("-p") .arg(port.to_string()) .stdout(Stdio::null()) + .stderr(Stdio::null()) .spawn()?; wait_for_port(port)?;