spielrs_diff

Crates.iospielrs_diff
lib.rsspielrs_diff
version0.2.1
sourcesrc
created_at2020-05-08 21:16:43.437349
updated_at2021-06-16 23:21:55.41668
descriptionIt is a library which compare two direcories or two files asynchronously
homepage
repositoryhttps://github.com/spielrs/spielrs-diff
max_upload_size
id239013
size22,055
F.J. Navarro (dancespiele)

documentation

https://docs.rs/crate/spielrs_diff/0.2.0

README

Spielrs Diff

Crate Info API Docs Discord Chat

It is a library which compare two directories or two files asynchronously through tokio and return true in case that both are different. Useful to create watchers in the servers

How install it

  1. add the dependency in the Cargo.toml file of the project:
spielrs_diff = "0.2"

Example

Dir comparation

use spielrs_diff::dir_diff;
#[tokio::test]
async fn should_return_true_if_both_dir_tree_are_different() {
   let diff = dir_diff(
       "./mocks/dir_one".to_string(),
       "./mocks/dir_three".to_string(),
   )
   .await;
   assert_eq!(diff, true);
}

File comparation

use spielrs_diff::{file_diff, diff::FileDiff};
#[tokio::test]
async fn should_return_true_if_both_files_are_not_equal() {
    let diff = file_diff(FileDiff {
        file: "./mocks/dir_one/vlang/purpose/purpose.txt".to_string(),
        file_comp: "./mocks/dir_five/vlang/purpose/purpose.txt".to_string(),
    })
    .await;
    assert_eq!(diff, true);
}

License

Spielrs Diff is MIT licensed. See license

Commit count: 12

cargo fmt