| Crates.io | patchkit |
| lib.rs | patchkit |
| version | 0.2.2 |
| created_at | 2023-11-28 16:45:10.291527+00 |
| updated_at | 2025-10-28 10:39:29.193534+00 |
| description | A library for parsing and manipulating patch files |
| homepage | https://github.com/breezy-team/patchkit |
| repository | https://github.com/breezy-team/patchkit |
| max_upload_size | |
| id | 1052175 |
| size | 941,147 |
This crate provides support for parsing and editing of unified diff files, as well as related files (e.g. quilt).
edit moduleuse patchkit::edit;
let patch_text = r#"--- a/file.txt
+++ b/file.txt
@@ -1,3 +1,3 @@
line 1
-line 2
+line 2 modified
line 3
"#;
let parsed = edit::parse(patch_text);
let patch = parsed.tree();
for patch_file in patch.patch_files() {
for hunk in patch_file.hunks() {
for line in hunk.lines() {
if let Some(text) = line.text() {
println!("{}", text);
}
}
}
}