rollsum

Crates.iorollsum
lib.rsrollsum
version0.3.0
sourcesrc
created_at2015-05-06 20:04:14.650919
updated_at2020-09-27 17:45:32.523961
descriptionRolling checksum implementation
homepage
repositoryhttps://github.com/aidanhs/rsroll
max_upload_size
id2043
size20,592
Dawid Ciężarkiewicz (dpc)

documentation

http://aidanhs.github.io/rsroll/

README

rollsum is based on bupsplit, which in turn is based on rsync chunking.

Interface liable to change.

https://docs.rs/rollsum

extern crate rollsum;

use std::env;
use std::fs;
use std::path::Path;
use std::io::prelude::*;

pub fn main () {
    let args: Vec<_> = env::args().collect();
    let mut file = fs::File::open(&Path::new(&args[1])).unwrap();
    let mut buf = vec![];
    file.read_to_end(&mut buf).unwrap();

    let mut ofs: usize = 0;
    while ofs < buf.len() {
        let mut b = rollsum::Bup::new();
        if let Some(count) = b.find_chunk_edge(&buf[ofs..]) {
            ofs += count;
            println!("found edge at {}", ofs);
        } else {
            println!("end of the line!");
            break
        }
    }
}
Commit count: 57

cargo fmt