1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#![cfg_attr(feature = "bench", feature(test))]
#[cfg(test)]
extern crate rand;
#[cfg(feature = "bench")]
extern crate test;
pub mod bup;
pub use bup::Bup;
pub mod gear;
pub use gear::Gear;
pub mod fastcdc;
pub use fastcdc::FastCDC;
pub trait RollingHash {
type Digest;
fn roll_byte(&mut self, buf: u8);
fn roll(&mut self, buf: &[u8]) {
buf.iter().map(|&b| self.roll_byte(b)).count();
}
fn digest(&self) -> Self::Digest;
fn reset(&mut self);
}
pub trait CDC {
fn find_chunk<'a>(&mut self, buf: &'a [u8]) -> Option<(&'a [u8], &'a [u8])>;
}
#[cfg(test)]
mod tests;