Expand description
§Same Content
Determine whether data from different sources are the same.
§Example
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 comparison functions is 8192 bytes per stream.
Use a *_with_buffer_size function to select a different size with a const generic argument.
use std::fs::File;
use same_content::*;
assert!(!same_content_from_files_with_buffer_size::<4096>(&mut File::open("tests/data/P1140310.jpg").unwrap(), &mut File::open("tests/data/P1140558.jpg").unwrap()).unwrap());§Asynchronous APIs
You may want to use async APIs with your async runtime. This crate supports tokio, currently.
[dependencies.same-content]
version = "*"
features = ["tokio"]After enabling the async feature, the async functions are available.
Functions§
- same_
content_ from_ files - Determines whether two files have the same content using the default buffer size.
- same_
content_ from_ files_ async tokio - Determines whether two Tokio files have the same content using the default buffer size.
- same_
content_ from_ files_ async_ with_ buffer_ size tokio - Determines whether two Tokio files have the same content using
BUFFER_SIZEbytes per stream. - same_
content_ from_ files_ with_ buffer_ size - Determines whether two files have the same content using
BUFFER_SIZEbytes per stream. - same_
content_ from_ readers - Determines whether two readers have the same remaining content using the default buffer size.
- same_
content_ from_ readers_ async tokio - Determines whether two Tokio readers have the same remaining content using the default buffer size.
- same_
content_ from_ readers_ async_ with_ buffer_ size tokio - Determines whether two Tokio readers have the same remaining content using
BUFFER_SIZEbytes per stream. - same_
content_ from_ readers_ with_ buffer_ size - Determines whether two readers have the same remaining content using
BUFFER_SIZEbytes per stream.