cargo fmt
Rust Build / Check (pull_request) Successful in 1m4s
Rust Build / Rustfmt (pull_request) Successful in 47s
Rust Build / Clippy (pull_request) Failing after 37s
Rust Build / build (pull_request) Successful in 27s
Rust Build / Test Suite (pull_request) Successful in 26s
Rust Build / Check (pull_request) Successful in 1m4s
Rust Build / Rustfmt (pull_request) Successful in 47s
Rust Build / Clippy (pull_request) Failing after 37s
Rust Build / build (pull_request) Successful in 27s
Rust Build / Test Suite (pull_request) Successful in 26s
This commit is contained in:
+3
-1
@@ -12,7 +12,9 @@ async fn main() {
|
|||||||
|
|
||||||
let filepath = &args[1];
|
let filepath = &args[1];
|
||||||
println!("Filepath: {filepath:?}");
|
println!("Filepath: {filepath:?}");
|
||||||
let prsr = parser::NumberParser{filepath: filepath.clone()};
|
let prsr = parser::NumberParser {
|
||||||
|
filepath: filepath.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
match prsr.file_dump().await {
|
match prsr.file_dump().await {
|
||||||
Ok(contacts) => {
|
Ok(contacts) => {
|
||||||
|
|||||||
+21
-20
@@ -1,4 +1,4 @@
|
|||||||
use std::io::{BufRead};
|
use std::io::BufRead;
|
||||||
|
|
||||||
const LETTERS: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const LETTERS: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
@@ -8,7 +8,9 @@ pub struct NumberParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl NumberParser {
|
impl NumberParser {
|
||||||
pub async fn file_dump(&self) -> Result<Vec<textsender_models::contact::Contact>, std::io::Error> {
|
pub async fn file_dump(
|
||||||
|
&self,
|
||||||
|
) -> Result<Vec<textsender_models::contact::Contact>, std::io::Error> {
|
||||||
println!("Dumping files");
|
println!("Dumping files");
|
||||||
let mut objs: Vec<textsender_models::contact::Contact> = Vec::new();
|
let mut objs: Vec<textsender_models::contact::Contact> = Vec::new();
|
||||||
|
|
||||||
@@ -34,9 +36,7 @@ impl NumberParser {
|
|||||||
|
|
||||||
Ok(removed_duplicates)
|
Ok(removed_duplicates)
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => Err(err),
|
||||||
Err(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,16 +44,14 @@ impl NumberParser {
|
|||||||
let filename = String::from("numbers.json");
|
let filename = String::from("numbers.json");
|
||||||
|
|
||||||
match serde_json::to_string(&numbers) {
|
match serde_json::to_string(&numbers) {
|
||||||
Ok(json_string) => {
|
Ok(json_string) => match std::fs::write(&filename, json_string) {
|
||||||
match std::fs::write(&filename, json_string) {
|
Ok(_) => {
|
||||||
Ok(_) => {
|
println!("Saved to: {filename:?}");
|
||||||
println!("Saved to: {filename:?}");
|
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
eprintln!("Error: {err:?}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
Err(err) => {
|
||||||
|
eprintln!("Error: {err:?}");
|
||||||
|
}
|
||||||
|
},
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("Error: {err:?}");
|
eprintln!("Error: {err:?}");
|
||||||
}
|
}
|
||||||
@@ -76,13 +74,14 @@ impl NumberParser {
|
|||||||
let reader = std::io::BufReader::new(file);
|
let reader = std::io::BufReader::new(file);
|
||||||
reader.lines().collect()
|
reader.lines().collect()
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => Err(err),
|
||||||
Err(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn remove_dups(&self, contacts: &Vec<textsender_models::contact::Contact>) -> Vec<textsender_models::contact::Contact> {
|
async fn remove_dups(
|
||||||
|
&self,
|
||||||
|
contacts: &Vec<textsender_models::contact::Contact>,
|
||||||
|
) -> Vec<textsender_models::contact::Contact> {
|
||||||
let mut unique_contacts: Vec<textsender_models::contact::Contact> = Vec::new();
|
let mut unique_contacts: Vec<textsender_models::contact::Contact> = Vec::new();
|
||||||
let mut unique_items = std::collections::HashSet::new();
|
let mut unique_items = std::collections::HashSet::new();
|
||||||
|
|
||||||
@@ -100,9 +99,11 @@ impl NumberParser {
|
|||||||
|
|
||||||
unique_contacts
|
unique_contacts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn update_contacts(&self, contacts: &Vec<textsender_models::contact::Contact>) -> Vec<textsender_models::contact::Contact> {
|
async fn update_contacts(
|
||||||
|
&self,
|
||||||
|
contacts: &Vec<textsender_models::contact::Contact>,
|
||||||
|
) -> Vec<textsender_models::contact::Contact> {
|
||||||
let mut updated: Vec<textsender_models::contact::Contact> = Vec::new();
|
let mut updated: Vec<textsender_models::contact::Contact> = Vec::new();
|
||||||
|
|
||||||
for ct in contacts {
|
for ct in contacts {
|
||||||
|
|||||||
Reference in New Issue
Block a user