3 releases (1 stable)

Uses old Rust 2015

1.0.0 Apr 10, 2016
0.2.0 Feb 1, 2015
0.1.0 Dec 23, 2014

#323 in Testing

Download history 12865/week @ 2024-09-26 13917/week @ 2024-10-03 12897/week @ 2024-10-10 16607/week @ 2024-10-17 12190/week @ 2024-10-24 11526/week @ 2024-10-31 12687/week @ 2024-11-07 16615/week @ 2024-11-14 12715/week @ 2024-11-21 15230/week @ 2024-11-28 12240/week @ 2024-12-05 12150/week @ 2024-12-12 9753/week @ 2024-12-19 9446/week @ 2024-12-26 11400/week @ 2025-01-02 13972/week @ 2025-01-09

46,731 downloads per month
Used in 39 crates (26 directly)

BSD-3-Clause

285KB
50 lines

Contains (ELF exe/lib, 720KB) testdata/rust_hello, (ELF exe/lib, 9KB) testdata/c_hello, (ELF exe/lib, 9KB) testdata/c_hello_copy

File Diff

This module provides an atomic file diffing function for use in unit tests.

The diff_files() function takes two file handles and determines returns true if they point to identical files.

use file_diff::{diff_files};
use std::fs::{File};

let mut file1 = match File::open("./src/lib.rs") {
    Ok(f) => f,
    Err(e) => panic!("{}", e),
};
let mut file2 = match File::open("./src/lib.rs") {
    Ok(f) => f,
    Err(e) => panic!("{}", e),
};

diff_files(&mut file1, &mut file2);

The diff() function takes string representations of the files and returns true if the strings represent real files and those files are identical.

use file_diff::{diff};

diff("./src/lib.rs", "./src/lib.rs"); // true

lib.rs:

File Diff

This module provides an atomic file diffing function for use in unit tests.

The diff_files() function takes two file handles and determines returns true if they point to identical files.

use file_diff::{diff_files};
use std::fs::{File};

let mut file1 = match File::open("./src/lib.rs") {
    Ok(f) => f,
    Err(e) => panic!("{}", e),
};
let mut file2 = match File::open("./src/lib.rs") {
    Ok(f) => f,
    Err(e) => panic!("{}", e),
};

diff_files(&mut file1, &mut file2);

The diff() function takes string representations of the files and returns true if the strings represent real files and those files are identical.

use file_diff::{diff};

diff("./src/lib.rs", "./src/lib.rs");

No runtime deps