1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! # file-editor
//! **Fluent, chain-friendly text-file editing for Rust (edition 2024)**
//!
//! ---
//! ## Quick taste
//! ```no_run
//! use file_editor::Editor;
//!
//! fn main() -> std::io::Result<()> {
//! Editor::create("demo.txt")? // create or truncate
//! .append("world\n")
//! .prepend("hello ")
//! .insert_after("hello", " Rustaceans!\n", false)
//! .save()?; // flush to disk
//! Ok(())
//! }
//! ```
//!
//! ---
//! ## Opt-in **regex** power
//! The default build is **zero-dependency**.
//! Enable the feature below to pass a compiled `regex::Regex` anywhere a pattern is accepted.
//!
//! ```toml
//! file-editor = { version = "0.2", features = ["regex"] }
//! ```
//!
//! ```ignore
//! use file_editor::Editor;
//! use regex::Regex;
//!
//! fn main() -> std::io::Result<()> {
//! let re = Regex::new(r"token=\w+")?; // redact secrets
//! Editor::open("config.env")?
//! .mask(&re, "***")
//! .save()?;
//! Ok(())
//! }
//! ```
//!
//! ---
//! **See [`Editor`] for the complete API and method-by-method examples.**
pub use Editor;