9 releases

Uses old Rust 2015

0.2.4 Nov 15, 2019
0.2.3 Nov 15, 2019
0.2.0 Apr 25, 2017
0.1.3 Apr 22, 2017

#2361 in Parser implementations

24 downloads per month

MIT license

350KB
3K SLoC

retrosheet-rs Build Status codecov crates.io

retrosheet is a Rust crate for parsing event data from Retrosheet, a baseball statistics aggregator. Currently, it only supports parsing the .EVX files that store a sequence of metadata and play-by-play data.

Using retrosheet is fairly straightforward, and most information can be gleaned by looking at the documentation or at Retrosheet's event file specification, although the latter is somewhat incomplete.

To use the parser, provide the byte-data of one or more games (e.g. from reading an EVX file) and use the parse method on the parser. This will return a vector of Game objects which store a variety of data, described in the documentation. For example:

let buf: Vec<u8>; // some buffer which may have been read into by a file
let mut parser = Parser::new();
match parser.parse(&buf) {
    Ok(ref games) => {
        for game in games {
            // Do something with the game here
        }
    },
    Err(ref e) => {
        panic!("Oh no! An error occurred: {}", e);
    }
}

Dependencies

~1MB
~18K SLoC