9个版本
使用旧的Rust 2015
0.2.4 | 2019年11月15日 |
---|---|
0.2.3 | 2019年11月15日 |
0.2.0 | 2017年4月25日 |
0.1.3 | 2017年4月22日 |
在解析器实现中排名2361
每月下载24次
350KB
3K SLoC
retrosheet-rs

retrosheet
是一个用于从 Retrosheet(一个棒球统计数据聚合器)解析事件数据的 Rust 包。目前,它仅支持解析存储一系列元数据和逐球数据的 .EVX
文件。
使用 retrosheet
相对简单,大多数信息可以通过查看 文档 或 Retrosheet 的 事件文件规范 获取,尽管后者可能有些不完整。
要使用解析器,提供一或多个比赛的字节数据(例如,从读取一个 EVX
文件),然后在解析器上使用 parse
方法。这将返回一个包含各种数据的 Game
对象的向量,具体请参考 文档。例如
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);
}
}
依赖项
~1MB
~18K SLoC