1use std::path::Path;
2
3pub mod diff;
4
5pub mod parser;
6
7pub struct DiffManager {}
8impl DiffManager {
9 pub fn parse(
10 format: &diff::DiffFormat,
11 diff: &str,
12 ) -> Result<diff::DiffComposition, parser::ParseError> {
13 match format {
14 diff::DiffFormat::GitUdiff => parser::Parser::parse_git_udiff(diff),
15 }
16 }
17
18 pub fn apply(
19 comp: &diff::DiffComposition,
20 root: &Path,
21 ) -> Result<(), diff::DiffError> {
22 comp.apply(root)
23 }
24
25 pub fn revert(
26 comp: &diff::DiffComposition,
27 root: &Path,
28 ) -> Result<(), diff::DiffError> {
29 comp.revert(root)
30 }
31}