mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 10:14:10 +02:00
basic example that parser all
This commit is contained in:
parent
fe6c884d4e
commit
b7d189b2a0
1 changed files with 2 additions and 4 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue