file-editor 0.1.0

Clean, elegant API for creating and editing text files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! cargo run --example find_lines
use file_editor::Editor;
use std::path::Path;

fn main() -> std::io::Result<()> {
    let p = Path::new("examples/sandbox/find.txt");
    Editor::create(p)?
        .append("foo\nbar\nfoo\nbaz\n") // two “foo” matches
        .save()?;

    let ed = Editor::open(p)?;
    println!("foo at lines {:?}", ed.find_lines("foo", None));
    Ok(())
}