mirror of
https://codeberg.org/demostf/parser.git
synced 2026-10-01 08:44:05 +02:00
borrowed data
This commit is contained in:
parent
fed1da5cb0
commit
a4ddd586dd
27 changed files with 181 additions and 176 deletions
|
|
@ -20,15 +20,15 @@ pub mod synctick;
|
|||
pub mod usercmd;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Packet {
|
||||
Sigon(MessagePacket),
|
||||
Message(MessagePacket),
|
||||
pub enum Packet<'a> {
|
||||
Sigon(MessagePacket<'a>),
|
||||
Message(MessagePacket<'a>),
|
||||
SyncTick(SyncTickPacket),
|
||||
ConsoleCmd(ConsoleCmdPacket),
|
||||
UserCmd(UserCmdPacket),
|
||||
DataTables(DataTablePacket),
|
||||
Stop(StopPacket),
|
||||
StringTables(StringTablePacket),
|
||||
StringTables(StringTablePacket<'a>),
|
||||
}
|
||||
|
||||
#[derive(BitRead, TryFromPrimitive, Debug, Clone, Copy)]
|
||||
|
|
@ -45,8 +45,8 @@ pub enum PacketType {
|
|||
StringTables = 8,
|
||||
}
|
||||
|
||||
impl Parse for Packet {
|
||||
fn parse(stream: &mut Stream, state: &ParserState) -> Result<Self> {
|
||||
impl<'a> Parse<'a> for Packet<'a> {
|
||||
fn parse(stream: &mut Stream<'a>, state: &ParserState) -> Result<Self> {
|
||||
let packet_type = PacketType::read(stream)?;
|
||||
Ok(match packet_type {
|
||||
PacketType::Sigon => Packet::Sigon(MessagePacket::parse(stream, state)?),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue