Crate unidiff

Crate unidiff 

Source
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
PatchSet
Unfied patchset
PatchedFile
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::parse result type