Crates.io | filewalker |
lib.rs | filewalker |
version | 0.0.1 |
source | src |
created_at | 2023-01-07 01:10:16.0711 |
updated_at | 2023-01-07 01:10:16.0711 |
description | A utility for walking lined files under certain conditions. |
homepage | https://github.com/lukerhoads/filewalker |
repository | https://github.com/lukerhoads/filewalker |
max_upload_size | |
id | 752708 |
size | 15,614 |
filewalker
Taken and modified from mrfutils-rs which used it to walk lined .txt
files from a specified location in the file.
An example:
let mut forward = vec![];
for line in open_file("file.txt", None, None, None).unwrap() {
println!(line);
}
Another way is to use the builder pattern:
let mut forward = vec![];
let opener = OpenerBuilder::default()
.path("file.txt".to_string())
.position("end")
.direction("backward")
.build()
.unwrap()
for line in opener.open() {
println!(line);
}