basic example that parser all

This commit is contained in:
Robin Appelman 2023-03-05 22:22:16 +01:00
commit b7d189b2a0

View file

@ -1,15 +1,13 @@
use main_error::MainError;
use std::env::args;
use std::fs;
use tf_log_parser::{GameEvent, RawEvent};
use tf_log_parser::{GameEvent, LineSplit, RawEvent};
fn main() -> Result<(), MainError> {
let path = args().nth(1).expect("No path provided");
let input = fs::read_to_string(path)?;
let events: Vec<_> = input
.split("L ")
.filter(|line| !line.is_empty())
let events: Vec<_> = LineSplit::new(&input)
.flat_map(RawEvent::parse)
.flat_map(|raw| GameEvent::parse(&raw))
.collect();