This commit is contained in:
2025-03-26 12:41:58 -04:00
parent 637b26a0e9
commit 416dd617e6
36 changed files with 732 additions and 0 deletions

1
example_3/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target

7
example_3/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "example_3"
version = "0.1.0"
edition = "2021"
[dependencies]
rayon = "1.10.0"

19
example_3/src/main.rs Normal file
View File

@@ -0,0 +1,19 @@
use rayon::iter::{IntoParallelIterator, IntoParallelRefIterator, ParallelIterator};
use std::fs::read_to_string;
fn main() {
// read a csv file to a string
let my_string = read_to_string("my_file.txt").unwrap();
let my_vec = my_string.lines().collect::<Vec<&str>>();
let my_vec: Vec<String> = my_vec
//.into_iter()
.into_par_iter()
.filter(|x| x.contains("ERROR"))
.map(|x| x.to_owned())
.collect();
// this should now print a vec of vecs
// where every single value is the "Hello world!" string
println!("{:?}", my_vec);
}