diff_man/
lib.rs

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
use std::path::Path;

pub mod diff;

pub mod parser;

pub struct DiffManager {}
impl DiffManager {
    pub fn parse(
        format: &diff::DiffFormat,
        diff: &str,
    ) -> Result<diff::DiffComposition, parser::ParseError> {
        match format {
            diff::DiffFormat::GitUdiff => parser::Parser::parse_git_udiff(diff),
        }
    }

    pub fn apply(
        comp: &diff::DiffComposition,
        root: &Path,
    ) -> Result<(), diff::DiffError> {
        comp.apply(root)
    }

    pub fn revert(
        comp: &diff::DiffComposition,
        root: &Path,
    ) -> Result<(), diff::DiffError> {
        comp.revert(root)
    }
}