Expand description
Unified diff parsing/metadata extraction library for Rust
§Examples
extern crate unidiff;
use unidiff::PatchSet;
fn main() {
let diff_str = "diff --git a/added_file b/added_file
new file mode 100644
index 0000000..9b710f3
--- /dev/null
+++ b/added_file
@@ -0,0 +1,4 @@
+This was missing!
+Adding it now.
+
+Only for testing purposes.";
let mut patch = PatchSet::new();
patch.parse(diff_str).ok().expect("Error parsing diff");
}Structs§
- Hunk
- Each of the modified blocks of a file
- Line
- A diff line
- Patch
Set - Unfied patchset
- Patched
File - Patch updated file, contains a list of Hunks
Enums§
- Error
- Error type
Constants§
- LINE_
TYPE_ ADDED - Diff line is added
- LINE_
TYPE_ CONTEXT - Diff line is context
- LINE_
TYPE_ EMPTY - Diff line is empty
- LINE_
TYPE_ REMOVED - Diff line is removed
Type Aliases§
- Result
unidiff::parseresult type