mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-11-30 04:40:47 +01:00
subject postprocessing
This commit is contained in:
parent
ca61f4ea6a
commit
747ee7d1a9
10 changed files with 2970 additions and 22 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use crate::common::SubjectId;
|
||||
use crate::raw_event::{RawEvent, RawEventType};
|
||||
use crate::SubjectMap;
|
||||
pub use chat::{ChatHandler, ChatMessage, ChatType};
|
||||
pub use lobbysettings::{
|
||||
LobbySettingsError, LobbySettingsHandler, Location, Settings as LobbySettings,
|
||||
|
|
@ -25,7 +26,7 @@ pub trait EventHandler: Default {
|
|||
event: &RawEvent,
|
||||
) -> Result<(), Self::Error>;
|
||||
|
||||
fn finish(self) -> Self::Output;
|
||||
fn finish(self, subjects: &SubjectMap) -> Self::Output;
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -57,8 +58,8 @@ impl<Head: EventHandler, Tail: EventHandler> EventHandler for HandlerStack<Head,
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn finish(self) -> Self::Output {
|
||||
(self.head.finish(), self.tail.finish())
|
||||
fn finish(self, subjects: &SubjectMap) -> Self::Output {
|
||||
(self.head.finish(subjects), self.tail.finish(subjects))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -112,9 +113,9 @@ impl<Handler: EventHandler> EventHandler for OptionalHandler<Handler> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn finish(self) -> Self::Output {
|
||||
fn finish(self, subjects: &SubjectMap) -> Self::Output {
|
||||
match self {
|
||||
OptionalHandler::Active(handler) => Ok(handler.finish()),
|
||||
OptionalHandler::Active(handler) => Ok(handler.finish(subjects)),
|
||||
OptionalHandler::Failed(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue