1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 18:24:05 +02:00

made DemoTicker cloneable

This commit is contained in:
Tails8521 2020-09-22 22:30:08 +02:00 committed by Robin Appelman
commit b7e6db1f4f
5 changed files with 7 additions and 2 deletions

View file

@ -15,7 +15,7 @@ pub struct CreateStringTableMessage<'a> {
pub table: Box<StringTable<'a>>, pub table: Box<StringTable<'a>>,
} }
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct StringTableMeta { pub struct StringTableMeta {
pub max_entries: u16, pub max_entries: u16,
pub fixed_userdata_size: Option<FixedUserDataSize>, pub fixed_userdata_size: Option<FixedUserDataSize>,

View file

@ -26,6 +26,7 @@ pub trait BorrowMessageHandler: MessageHandler {
fn borrow_output(&self, state: &ParserState) -> &Self::Output; fn borrow_output(&self, state: &ParserState) -> &Self::Output;
} }
#[derive(Clone)]
pub struct DemoHandler<'a, T: MessageHandler> { pub struct DemoHandler<'a, T: MessageHandler> {
pub tick: u32, pub tick: u32,
string_table_names: Vec<Cow<'a, str>>, string_table_names: Vec<Cow<'a, str>>,

View file

@ -92,6 +92,7 @@ impl<'a, A: MessageHandler> DemoParser<'a, A> {
} }
} }
#[derive(Clone)]
pub struct RawPacketStream<'a> { pub struct RawPacketStream<'a> {
stream: Stream<'a>, stream: Stream<'a>,
ended: bool, ended: bool,

View file

@ -16,13 +16,14 @@ use crate::nullhasher::NullHasherBuilder;
use crate::{Result, Stream}; use crate::{Result, Stream};
use std::cell::RefCell; use std::cell::RefCell;
#[derive(Default)] #[derive(Default, Clone)]
pub struct DemoMeta { pub struct DemoMeta {
pub version: u16, pub version: u16,
pub game: String, pub game: String,
pub interval_per_tick: f32, pub interval_per_tick: f32,
} }
#[derive(Clone)]
pub struct ParserState { pub struct ParserState {
pub static_baselines: HashMap<ClassId, StaticBaseline, NullHasherBuilder>, pub static_baselines: HashMap<ClassId, StaticBaseline, NullHasherBuilder>,
pub parsed_static_baselines: RefCell<HashMap<ClassId, Vec<SendProp>, NullHasherBuilder>>, pub parsed_static_baselines: RefCell<HashMap<ClassId, Vec<SendProp>, NullHasherBuilder>>,
@ -38,6 +39,7 @@ pub struct ParserState {
parse_all: bool, parse_all: bool,
} }
#[derive(Clone)]
pub struct StaticBaseline { pub struct StaticBaseline {
pub class_id: ClassId, pub class_id: ClassId,
pub raw: Stream<'static>, pub raw: Stream<'static>,

View file

@ -34,6 +34,7 @@ impl Hasher for NullHasher {
} }
} }
#[derive(Clone)]
pub struct NullHasherBuilder; pub struct NullHasherBuilder;
impl BuildHasher for NullHasherBuilder { impl BuildHasher for NullHasherBuilder {