blockcounter

Crates.ioblockcounter
lib.rsblockcounter
version0.3.2
sourcesrc
created_at2017-12-21 20:16:46.132673
updated_at2018-07-17 02:38:53.795806
descriptionCounts the blocks in a stream.
homepage
repositoryhttps://github.com/kirch7/blockcounter
max_upload_size
id43884
size18,568
Cássio Kirch (kirch7)

documentation

https://docs.rs/blockcounter

README

blockcounter

Version info Build Status Build status

Count blocks in a text.

Example

extern crate blockcounter;
use blockcounter::{count_blocks, Blocks, clean};

fn main() {
    let text = "0\n1\n\n2\n\n\n3\n\n".to_string();
    println!("{}", text);
    println!("===========");
    println!("text has {} blocks.", count_blocks(2, text.as_bytes()));
    println!("======================");
    println!("");
    
    for block in Blocks::new(2, text.as_bytes()) {
        print!("{}", clean(&block));
        println!("=============");
    }
}
Commit count: 51

cargo fmt