move event parsing to derive macros

This commit is contained in:
Robin Appelman 2023-03-05 22:31:48 +01:00
commit 14c1fbe0d9
13 changed files with 591 additions and 460 deletions

23
derive/examples/expand.rs Normal file
View 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() {}