diff-trees 0.1.3

Diff two directory trees based on their content
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::path::Path;

use crate::Result;
use crate::StripPrefixError;

pub(crate) fn strip_prefix(path: &Path, prefix: impl AsRef<Path>) -> Result<&Path> {
    let prefix = prefix.as_ref();
    Ok(path.strip_prefix(prefix).map_err(|_| StripPrefixError {
        path: path.to_owned(),
        prefix: prefix.to_owned(),
    })?)
}