vortaroboto

Log | Files | Refs | README

commit 442164ee835b3a17bc2063b1c11700bfc0a6207f
parent a70481d1ff12201f0930f84b59282969fc5aa312
Author: tomvig38@gmail.com <tomvig38@gmail.com>
Date:   Mon, 25 Oct 2021 07:54:31 +0000

korektu tablvortojn
Diffstat:
MCargo.lock | 12------------
MCargo.toml | 2+-
Msrc/main.rs | 9+++++++--
3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -920,15 +920,6 @@ dependencies = [ ] [[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] name = "simple_logger" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1049,10 +1040,7 @@ dependencies = [ "memchr", "mio", "num_cpus", - "once_cell", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "tokio-macros", "winapi", ] diff --git a/Cargo.toml b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] irc = { version = "0.15.0", default-features = false, features = ["tls-rust", "ctcp"] } -tokio = { version = "1.12.0", features = ["full"] } +tokio = { version = "1.12.0", features = ["rt-multi-thread", "macros"] } futures = "0.3.17" reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] } serde = { version = "1.0", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs @@ -143,10 +143,15 @@ async fn add_words(frazo: String) { { // Konstrui la vera vorto let mut vorto = String::with_capacity(vorto.len()); - for p in vf.partoj.iter().take_while(|p| p.vorto.is_some()) { + let mut last_i = 0; + for (i, p) in vf.partoj.iter().enumerate().take_while(|(_, p)| p.vorto.is_some()) { vorto.push_str(p.parto.as_str()); + last_i = i; + } + + if last_i != vf.partoj.len() { + vorto.push('-'); } - vorto.push('-'); if let Some(v) = h.get_mut(&vorto) { *v += 1;