Remove rayon

This commit is contained in:
Leon Grünewald 2024-12-10 21:20:54 +01:00
parent 84b17515a6
commit 82e2a49cdc
4 changed files with 3 additions and 52 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

46
Cargo.lock generated
View file

@ -192,31 +192,6 @@ version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]] [[package]]
name = "deranged" name = "deranged"
version = "0.3.11" version = "0.3.11"
@ -941,26 +916,6 @@ dependencies = [
"getrandom", "getrandom",
] ]
[[package]]
name = "rayon"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.7" version = "0.5.7"
@ -1278,7 +1233,6 @@ version = "0.1.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"maud", "maud",
"rayon",
"rocket", "rocket",
"serde", "serde",
"serde_json", "serde_json",

View file

@ -9,4 +9,3 @@ serde_json = "1.0"
rocket = "0.5" rocket = "0.5"
maud = { version = "0.26", features = ["rocket"] } maud = { version = "0.26", features = ["rocket"] }
chrono = "0.4" chrono = "0.4"
rayon = "1.10"

View file

@ -2,7 +2,6 @@ use maud::{html, Markup, DOCTYPE};
use rocket::{Rocket,Build,launch,get,routes,fs::{FileServer}}; use rocket::{Rocket,Build,launch,get,routes,fs::{FileServer}};
use std::collections::HashMap; use std::collections::HashMap;
use chrono::prelude::*; use chrono::prelude::*;
use rayon::prelude::*;
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
@ -112,15 +111,13 @@ fn index() -> Markup {
).expect("Could not parse result.json"); ).expect("Could not parse result.json");
println!("Done!"); println!("Done!");
let messages: Vec<ChatMessage> = tg_export_result.messages.into_par_iter().filter(|m| { let mut messages: Vec<ScoredChatMessage> = tg_export_result.messages.into_iter().filter(|m| {
return if let Some(media_type) = &m.media_type { return if let Some(media_type) = &m.media_type {
*media_type == MediaType::Sticker *media_type == MediaType::Sticker
} else { } else {
false false
} }
}).collect(); }).fold(HashMap::new(), |mut acc: HashMap<String, ScoredChatMessage>, message| {
let mut messages: Vec<ScoredChatMessage> = messages.into_iter().fold(HashMap::new(), |mut acc: HashMap<String, ScoredChatMessage>, message| {
let file = message.file.as_ref().expect("No file").to_owned(); let file = message.file.as_ref().expect("No file").to_owned();
if acc.contains_key(&file) { if acc.contains_key(&file) {
if let Some(scored_chat_message) = acc.get_mut(&file) { if let Some(scored_chat_message) = acc.get_mut(&file) {