[][src]Function skellige::prelude::sys::digest

pub fn digest<T>(path: T) -> Result<Vec<u8, Global>, FuError> where
    T: AsRef<Path>, 

Computes and returns the digest of the given path.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_digest");
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(sys::mkdir(&tmpdir).is_ok());
let file1 = tmpdir.mash("file1");
let file2 = tmpdir.mash("file2");
assert!(sys::write(&file1, "this is a test").is_ok());
assert!(sys::copyfile(&file1, &file2).is_ok());
assert_iter_eq(sys::digest(&file1).unwrap(), sys::digest(&file2).unwrap());
assert!(sys::remove_all(&tmpdir).is_ok());