mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
flake reorg
This commit is contained in:
parent
ce289200f8
commit
4d97759eca
11 changed files with 109 additions and 391 deletions
|
|
@ -21,7 +21,7 @@ struct JsonDemo {
|
|||
}
|
||||
|
||||
fn main() -> Result<(), MainError> {
|
||||
#[cfg(feature = "better_panic")]
|
||||
#[cfg(feature = "better-panic")]
|
||||
better_panic::install();
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ pub use tf_demo_parser::{Demo, DemoParser, Parse, ParseError, ParserState, Strea
|
|||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||
|
||||
fn main() -> Result<(), MainError> {
|
||||
#[cfg(feature = "better_panic")]
|
||||
#[cfg(feature = "better-panic")]
|
||||
better_panic::install();
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ struct JsonDemo {
|
|||
}
|
||||
|
||||
fn main() -> Result<(), MainError> {
|
||||
#[cfg(feature = "better_panic")]
|
||||
#[cfg(feature = "better-panic")]
|
||||
better_panic::install();
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ fn main() -> Result<(), MainError> {
|
|||
#[cfg(feature = "trace")]
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
#[cfg(feature = "better_panic")]
|
||||
#[cfg(feature = "better-panic")]
|
||||
better_panic::install();
|
||||
|
||||
let args: Vec<_> = env::args().collect();
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ use std::env;
|
|||
use std::fs;
|
||||
|
||||
use main_error::MainError;
|
||||
pub use tf_demo_parser::{Demo, DemoParser, Parse, ParserState};
|
||||
use tf_demo_parser::demo::packet::stringtable::{StringTableEntry};
|
||||
use tf_demo_parser::demo::packet::stringtable::StringTableEntry;
|
||||
use tf_demo_parser::demo::parser::MessageHandler;
|
||||
use tf_demo_parser::MessageType;
|
||||
pub use tf_demo_parser::{Demo, DemoParser, Parse, ParserState};
|
||||
|
||||
#[cfg(feature = "jemallocator")]
|
||||
#[global_allocator]
|
||||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||
|
||||
fn main() -> Result<(), MainError> {
|
||||
#[cfg(feature = "better_panic")]
|
||||
#[cfg(feature = "better-panic")]
|
||||
better_panic::install();
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
|
|
@ -60,10 +60,19 @@ impl MessageHandler for StringTableHandler {
|
|||
type Output = HashMap<String, Vec<String>>;
|
||||
|
||||
fn does_handle(message_type: MessageType) -> bool {
|
||||
matches!(message_type, MessageType::CreateStringTable | MessageType::UpdateStringTable)
|
||||
matches!(
|
||||
message_type,
|
||||
MessageType::CreateStringTable | MessageType::UpdateStringTable
|
||||
)
|
||||
}
|
||||
|
||||
fn handle_string_entry(&mut self, table: &str, index: usize, entries: &StringTableEntry, _parser_state: &ParserState) {
|
||||
fn handle_string_entry(
|
||||
&mut self,
|
||||
table: &str,
|
||||
index: usize,
|
||||
entries: &StringTableEntry,
|
||||
_parser_state: &ParserState,
|
||||
) {
|
||||
let table = self.tables.entry(table.into()).or_default();
|
||||
if index < table.len() {
|
||||
table[index] = entries.text().into();
|
||||
|
|
@ -72,8 +81,7 @@ impl MessageHandler for StringTableHandler {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
fn into_output(self, _state: &ParserState) -> Self::Output {
|
||||
self.tables
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue