filesystem_hashing/
lib.rs1#![allow(non_snake_case)]
2extern crate core;
3
4use crate::hasher::HashType;
5use crate::snapshot::{
6 compare_hashes, export, import, Snapshot, SnapshotChangeType, SnapshotCompareResult,
7};
8use anyhow::Error;
9use std::path::Path;
10pub mod hasher;
11pub mod snapshot;
12
13pub fn create_snapshot(
14 path: &str,
15 hash_type: HashType,
16 black_list: Vec<String>,
17 verbose: bool
18) -> Result<Snapshot, Error> {
19 Snapshot::new(Path::new(path), hash_type, black_list, verbose)
20}
21
22pub fn compare_snapshots(
23 left: Snapshot,
24 right: Snapshot,
25 verbose: bool
26) -> Option<(SnapshotChangeType, SnapshotCompareResult)> {
27 compare_hashes(left, right, verbose)
28}
29
30pub fn compare_snapshots_including_modify_date(
31 left: Snapshot,
32 right: Snapshot,
33 verbose: bool
34) -> Option<(SnapshotChangeType, SnapshotCompareResult)> {
35 compare_hashes(left, right, verbose)
36}
37
38pub fn export_snapshot(snapshot: Snapshot, path: String, overwrite: bool, verbose: bool) -> Result<(), Error> {
39 export(snapshot, path, overwrite, verbose)
40}
41
42pub fn import_snapshot(path: String, verbose: bool) -> Result<Snapshot, Error> {
43 import(path, verbose)
44}