mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 18:24:09 +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 main_error::MainError;
|
||||||
use std::env::args;
|
use std::env::args;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use tf_log_parser::{GameEvent, RawEvent};
|
use tf_log_parser::{GameEvent, LineSplit, RawEvent};
|
||||||
|
|
||||||
fn main() -> Result<(), MainError> {
|
fn main() -> Result<(), MainError> {
|
||||||
let path = args().nth(1).expect("No path provided");
|
let path = args().nth(1).expect("No path provided");
|
||||||
let input = fs::read_to_string(path)?;
|
let input = fs::read_to_string(path)?;
|
||||||
|
|
||||||
let events: Vec<_> = input
|
let events: Vec<_> = LineSplit::new(&input)
|
||||||
.split("L ")
|
|
||||||
.filter(|line| !line.is_empty())
|
|
||||||
.flat_map(RawEvent::parse)
|
.flat_map(RawEvent::parse)
|
||||||
.flat_map(|raw| GameEvent::parse(&raw))
|
.flat_map(|raw| GameEvent::parse(&raw))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue