mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 18:24:05 +02:00
remove multiplex for now due to borrow type issues
This commit is contained in:
parent
63f39e2f73
commit
83a13e5e52
2 changed files with 1 additions and 36 deletions
|
|
@ -25,41 +25,6 @@ pub trait BorrowMessageHandler: MessageHandler {
|
|||
fn borrow_output(&self, state: &ParserState) -> &Self::Output;
|
||||
}
|
||||
|
||||
pub struct MultiplexMessageHandler<A: MessageHandler, B: MessageHandler> {
|
||||
handler_a: A,
|
||||
handler_b: B,
|
||||
}
|
||||
|
||||
impl<A: MessageHandler, B: MessageHandler> MessageHandler for MultiplexMessageHandler<A, B> {
|
||||
type Output = (A::Output, B::Output);
|
||||
|
||||
fn does_handle(message_type: MessageType) -> bool {
|
||||
A::does_handle(message_type) || B::does_handle(message_type)
|
||||
}
|
||||
|
||||
fn handle_message(&mut self, message: &Message, tick: u32) {
|
||||
self.handler_a.handle_message(message, tick);
|
||||
self.handler_b.handle_message(message, tick);
|
||||
}
|
||||
|
||||
fn handle_string_entry(&mut self, table: &str, index: usize, entries: &StringTableEntry) {
|
||||
self.handler_a.handle_string_entry(table, index, entries);
|
||||
self.handler_b.handle_string_entry(table, index, entries);
|
||||
}
|
||||
|
||||
fn handle_data_tables(&mut self, tables: &[ParseSendTable], server_classes: &[ServerClass]) {
|
||||
self.handler_a.handle_data_tables(tables, server_classes);
|
||||
self.handler_b.handle_data_tables(tables, server_classes);
|
||||
}
|
||||
|
||||
fn into_output(self, state: &ParserState) -> Self::Output {
|
||||
(
|
||||
self.handler_a.into_output(state),
|
||||
self.handler_b.into_output(state),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DemoHandler<T: MessageHandler> {
|
||||
tick: u32,
|
||||
string_table_names: Vec<String>,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ impl<A: MessageHandler> DemoParser<A> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse(mut self) -> Result<(Header, A::Output)> {
|
||||
pub fn parse(self) -> Result<(Header, A::Output)> {
|
||||
let (header, mut ticker) = self.ticker()?;
|
||||
while ticker.tick()? {
|
||||
// noop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue