| Crates.io | fileio_handl |
| lib.rs | fileio_handl |
| version | 0.1.0 |
| created_at | 2025-07-15 12:01:13.762861+00 |
| updated_at | 2025-07-15 12:01:13.762861+00 |
| description | Simple "easy" file handler |
| homepage | |
| repository | https://github.com/amyoshi-hub/Rust_lib/tree/main/fileio-handler |
| max_upload_size | |
| id | 1753172 |
| size | 6,762 |
A minimal file handling utility written in Rust You can easily read and write text files, and extract numeric values using customizable separators.
fn main() -> Result<(), Box<dyn std::error::Error>>{
let mut file = FileIO::new("word_list.txt");
file.read_lines()?;
let sep_list = [":", "|"];
let mut result = Vec::new();
for line in &file.contents {
let split = FileIO::phaser(line, &sep_list);
let filtered: Vec<_> = split
.iter()
.filter(|s| s.trim().parse::<f32>().is_ok())
.cloned()
.collect();
let joined = filtered.join(", ");
result.push(joined);
}
FileIO::write_file("out.txt", &result)?;
Ok(())
}