4 releases
Uses old Rust 2015
0.2.2 | Apr 11, 2018 |
---|---|
0.2.1 | Jun 11, 2017 |
0.2.0 | Aug 30, 2016 |
0.1.0 | Aug 30, 2016 |
#135 in #split
10KB
173 lines
split_by
Split anything implementing Read trait by multiple sequences of bytes
Quick start
Add this to Cargo.toml, under [dependencies]
:
split_by = "0.2"
Usage
extern crate split_by;
use split_by::{AcAutomaton, SplitBy}
use std::fs::File;
fn main() {
for section in File::open("path/to/file").unwrap().split_by(&AcAutomaton::new(vec!["<some pattern>"])) {
let bytes = section.expect("read error occurred");
// do something with the bytes found between patterns
}
}
Dependencies
~1MB
~15K SLoC