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

add serde support for packets

This commit is contained in:
Robin Appelman 2021-07-25 15:09:36 +02:00
commit 03f8b8a424
27 changed files with 556 additions and 490 deletions

View file

@ -1,8 +1,9 @@
use bitbuffer::{BitRead, BitWrite, BitWriteSized, BitWriteStream, LittleEndian};
use serde::{Deserialize, Serialize};
use crate::{ReadResult, Stream};
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct VoiceInitMessage {
codec: String,
quality: u8,
@ -57,8 +58,9 @@ fn test_voice_init_roundtrip() {
});
}
#[derive(BitRead, BitWrite, Debug, Clone, PartialEq)]
#[derive(BitRead, BitWrite, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[endianness = "LittleEndian"]
#[serde(bound(deserialize = "'a: 'static"))]
pub struct VoiceDataMessage<'a> {
client: u8,
proximity: u8,
@ -67,7 +69,8 @@ pub struct VoiceDataMessage<'a> {
data: Stream<'a>,
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(bound(deserialize = "'a: 'static"))]
pub struct ParseSoundsMessage<'a> {
pub reliable: bool,
pub num: u8,