mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 18:24:09 +02:00
move event parsing to derive macros
This commit is contained in:
parent
b7d189b2a0
commit
14c1fbe0d9
13 changed files with 591 additions and 460 deletions
23
derive/examples/expand.rs
Normal file
23
derive/examples/expand.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use tf_log_parser::{
|
||||
event::{param_parse, parse_field, quoted, ParamIter},
|
||||
Event, IResult,
|
||||
};
|
||||
|
||||
#[derive(Event)]
|
||||
pub struct DamageEvent<'a> {
|
||||
#[event(name = "against")]
|
||||
pub target: RawSubject<'a>,
|
||||
pub damage: Option<NonZeroU32>,
|
||||
#[event(name = "realdamage")]
|
||||
pub real_damage: Option<NonZeroU32>,
|
||||
pub weapon: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Event)]
|
||||
pub struct ShotFiredEvent {
|
||||
#[event(quoted)]
|
||||
pub weapon: u32,
|
||||
pub damage: Option<u32>,
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue