mcw

Crates.iomcw
lib.rsmcw
version1.4.1
sourcesrc
created_at2024-11-20 19:12:39.716911
updated_at2024-11-23 12:20:57.930879
descriptionmcw - most common word
homepage
repository
max_upload_size
id1455160
size40,584
MateusDev (Matissoss)

documentation

README

mcw - most common word


mcw is rust crate that stands for: "most common word" mcw does what it says -> returns most common words

Using the Crate

use mcw::*;
fn main() -> Result<(), Box<dyn std::error::Error>>{
      let words : Vec<Word> = get_words("These are words. Lorem Ipsum.", false)?;
      for word in words{
          println!("{}", word);
      }
      Ok(())
}

Additional Note : argument of type bool contains whether the argument of type String is file directory or not. Error only may occur if bool is true.

If your project ships with tokio in dependencies, then you can use async version of mcw, using async feature in specifications. Only change is that program uses tokio::fs instead of std::fs

/Cargo.toml

[package]
name = "your_package"
version = "0.1.0"
edition = "2021"
[dependencies]
mcw = {version = "1.4.1", features = ["async"]}

/src/main.rs

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>>{
     let words : Vec<Word> = async_get_words("These are words. Lorem Ipsum. Async Version of
     function", false).await?;

     for word in words{
        println!("{}", word);
     }

     Ok(())
}
Commit count: 0

cargo fmt