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

remove the need to allocate all messages in a packet

This commit is contained in:
Robin Appelman 2020-12-06 19:29:11 +01:00
commit 25f24b63f6
7 changed files with 65 additions and 32 deletions

View file

@ -101,7 +101,7 @@ pub enum Message<'a> {
}
impl<'a> Parse<'a> for Message<'a> {
fn parse(stream: &mut Stream<'a>, state: &ParserState) -> Result<Self> {
fn parse(stream: &mut Stream<'a>, state: &ParserState<'a>) -> Result<Self> {
let message_type = MessageType::parse(stream, state)?;
Self::from_type(message_type, stream, state)
}
@ -144,7 +144,7 @@ impl<'a> Message<'a> {
pub fn from_type(
message_type: MessageType,
stream: &mut Stream<'a>,
state: &ParserState,
state: &ParserState<'a>,
) -> Result<Self> {
Ok(match message_type {
MessageType::Empty => Message::Empty,