Trait rollsum::Engine
[−]
[src]
pub trait Engine {
type Digest;
fn roll_byte(&mut self, byte: u8);
fn digest(&self) -> Self::Digest;
fn roll(&mut self, buf: &[u8]) { ... }
fn find_chunk_edge_cond<F>(&mut self, buf: &[u8], cond: F) -> Option<usize> where F: Fn(&Self) -> bool { ... }
}
Rolling sum engine trait
Associated Types
type Digest
Required Methods
fn roll_byte(&mut self, byte: u8)
Roll over one byte
fn digest(&self) -> Self::Digest
Return current rolling sum digest
Provided Methods
fn roll(&mut self, buf: &[u8])
Roll over a slice of bytes
fn find_chunk_edge_cond<F>(&mut self, buf: &[u8], cond: F) -> Option<usize> where F: Fn(&Self) -> bool
Find the end of the chunk.
Feed engine bytes from buf
and stop when chunk split was found.
Use cond
function as chunk split condition.
Return:
None - no chunk split was found
Some(offset) - offset of the first unconsumed byte of buf
.
offset == buf.len() if the chunk ended right after whole buf
.
Implementors
impl Engine for Bup