derive tweaks

This commit is contained in:
Robin Appelman 2026-11-15 16:24:02 +01:00
commit 1ce783ec11
Signed by: robin
SSH key fingerprint: SHA256:kifqgrqnut7q1YUIrI0AdMNC23qiKAS/T9uGFmIYvbE
12 changed files with 99 additions and 806 deletions

View file

@ -1,4 +1,4 @@
use crate::event::{param_parse_with, parse_field, ParamIter};
use crate::event::{parse_field, ParamIter};
use crate::raw_event::RawSubject;
use crate::{Error, Event, Result};

View file

@ -1,6 +1,5 @@
use crate::event::{parse_field, ParamIter};
use crate::raw_event::RawSubject;
use crate::{Event, Result};
use crate::Event;
#[derive(Debug, Event, Clone)]
pub struct HealedEvent<'a> {

View file

@ -8,6 +8,7 @@ use crate::{Error, Events, IResult, RawEvent, RawEventType, Result, SubjectId};
pub use game::*;
pub use medic::*;
pub use player::*;
use std::borrow::Cow;
use std::net::SocketAddr;
use std::num::NonZeroU32;
use std::str::FromStr;
@ -204,6 +205,12 @@ impl<'a> EventField<'a> for &'a str {
}
}
impl<'a> EventField<'a> for Cow<'a, str> {
fn parse_field(input: &'a str) -> Result<Self> {
Ok(input.into())
}
}
impl<'a, T: EventField<'a>> EventField<'a> for Option<T> {
fn parse_field(input: &'a str) -> Result<Self> {
T::parse_field(input).map(Some)

View file

@ -1,7 +1,6 @@
use crate::common::{Class, Team};
use crate::event::{param_parse_with, parse_field, quoted, ParamIter};
use crate::raw_event::{subject_parser, RawSubject};
use crate::{Error, Event, Result};
use crate::raw_event::RawSubject;
use crate::Event;
use std::net::SocketAddr;
#[derive(Debug, Event, Clone)]

View file

@ -1,3 +1,6 @@
/// allow referencing to this crate as `::tf_log_parser` from proc-macros used in this crate
extern crate self as tf_log_parser;
pub use crate::common::{Class, SteamId3, SubjectData, SubjectError, SubjectId};
pub use crate::module::EventHandler;
use crate::module::{