Got it working
Rust Build / Check (pull_request) Successful in 40s
Rust Build / Rustfmt (pull_request) Failing after 32s
Rust Build / Test Suite (pull_request) Successful in 47s
Rust Build / Clippy (pull_request) Failing after 30s
Rust Build / build (pull_request) Successful in 27s

This commit is contained in:
2026-06-06 12:18:51 -04:00
parent 55cac74fab
commit 422b773153
3 changed files with 39 additions and 21 deletions
Generated
+2
View File
@@ -79,6 +79,8 @@ name = "clean_file"
version = "0.8.2" version = "0.8.2"
dependencies = [ dependencies = [
"futures", "futures",
"serde",
"serde_json",
"tempfile", "tempfile",
"textsender_models", "textsender_models",
"tokio", "tokio",
+2
View File
@@ -8,6 +8,8 @@ rust-version = "1.95"
[dependencies] [dependencies]
tokio = { version = "1.52.2", features = ["full"] } tokio = { version = "1.52.2", features = ["full"] }
futures = { version = "0.3.32" } futures = { version = "0.3.32" }
serde = { version = "1.0.228", features = ["derive"] }
serde_json = { version = "1.0.149" }
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender-models.git", tag = "v0.2.5-v0.3.0-migrate-38dbcb09f7-111" } textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender-models.git", tag = "v0.2.5-v0.3.0-migrate-38dbcb09f7-111" }
[dev-dependencies] [dev-dependencies]
+35 -21
View File
@@ -1,4 +1,4 @@
use std::io::{BufRead, BufReader}; use std::io::{BufRead};
pub const LETTERS: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; pub const LETTERS: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -41,6 +41,40 @@ impl NumberParser {
} }
pub fn save_file(&self, numbers: Vec<textsender_models::contact::Contact>) { pub fn save_file(&self, numbers: Vec<textsender_models::contact::Contact>) {
// filename := "numbers.json"
let filename = String::from("numbers.json");
match serde_json::to_string(&numbers) {
Ok(json_string) => {
match std::fs::write(&filename, json_string) {
Ok(_) => {
println!("Saved to: {filename:?}");
}
Err(err) => {
eprintln!("Error: {err:?}");
}
}
}
Err(err) => {
eprintln!("Error: {err:?}");
}
};
// Create json and save it to the filesystem
/*
jsonData, err := json.MarshalIndent(&vals, "", " ")
if err != nil {
log.Println("Error marshaling JSON:", err)
return
}
err = os.WriteFile(filename, jsonData, 0644)
if err != nil {
log.Println("Error writing file:", err)
return
}
*/
} }
pub fn print_values(&self, numbers: &Vec<textsender_models::contact::Contact>) { pub fn print_values(&self, numbers: &Vec<textsender_models::contact::Contact>) {
@@ -150,23 +184,3 @@ impl NumberParser {
parsed parsed
} }
} }
/*
func (prsr NumberParser) SaveFile(vals []contact.Contact) {
filename := "numbers.json"
// Create json and save it to the filesystem
jsonData, err := json.MarshalIndent(&vals, "", " ")
if err != nil {
log.Println("Error marshaling JSON:", err)
return
}
err = os.WriteFile(filename, jsonData, 0644)
if err != nil {
log.Println("Error writing file:", err)
return
}
}
*/