Crate same_content[][src]

Same Content

Determine whether data from different sources are the same.

Example

extern crate same_content;

use std::fs::File;

use same_content::*;

assert!(!same_content_from_files(&mut File::open("tests/data/P1140310.jpg").unwrap(), &mut File::open("tests/data/P1140558.jpg").unwrap()).unwrap());

Change the Buffer Size

The default buffer size for the same_content_from_files function and the same_content_from_readers function is 256 bytes per stream. If you want to change that, you can use the same_content_from_files2 function or the same_content_from_readers2 function, and define a length explicitly.

For example, to change the buffer size to 4096 bytes,

#[macro_use] extern crate same_content;

use std::fs::File;

use same_content::*;
use same_content::generic_array::typenum::U4096;

assert!(!same_content_from_files2::<U4096>(&mut File::open("tests/data/P1140310.jpg").unwrap(), &mut File::open("tests/data/P1140558.jpg").unwrap()).unwrap());

Re-exports

pub extern crate generic_array;

Functions

same_content_from_files
same_content_from_files2
same_content_from_readers
same_content_from_readers2