mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-04 02:24:12 +02:00
make parserstate static
This commit is contained in:
parent
25f24b63f6
commit
e5e54de65d
8 changed files with 20 additions and 20 deletions
|
|
@ -101,7 +101,7 @@ pub enum Message<'a> {
|
|||
}
|
||||
|
||||
impl<'a> Parse<'a> for Message<'a> {
|
||||
fn parse(stream: &mut Stream<'a>, state: &ParserState<'a>) -> Result<Self> {
|
||||
fn parse(stream: &mut Stream<'a>, state: &ParserState) -> 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<'a>,
|
||||
state: &ParserState,
|
||||
) -> Result<Self> {
|
||||
Ok(match message_type {
|
||||
MessageType::Empty => Message::Empty,
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ pub struct PacketEntitiesMessage {
|
|||
pub updated_base_line: bool,
|
||||
}
|
||||
|
||||
fn get_send_table<'a, 'b>(state: &'b ParserState<'a>, class: ClassId) -> Result<&'b SendTable> {
|
||||
fn get_send_table<'a, 'b>(state: &'b ParserState, class: ClassId) -> Result<&'b SendTable> {
|
||||
state
|
||||
.send_tables
|
||||
.get(usize::from(class))
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ impl From<&StringTable<'_>> for StringTableMeta {
|
|||
}
|
||||
|
||||
impl<'a> Parse<'a> for CreateStringTableMessage<'a> {
|
||||
fn parse(stream: &mut Stream<'a>, _state: &ParserState<'a>) -> Result<Self> {
|
||||
fn parse(stream: &mut Stream<'a>, _state: &ParserState) -> Result<Self> {
|
||||
let name = stream.read()?;
|
||||
let max_entries: u16 = stream.read()?;
|
||||
let encode_bits = log_base2(max_entries);
|
||||
|
|
@ -116,7 +116,7 @@ pub struct UpdateStringTableMessage<'a> {
|
|||
}
|
||||
|
||||
impl<'a> Parse<'a> for UpdateStringTableMessage<'a> {
|
||||
fn parse(stream: &mut Stream<'a>, state: &ParserState<'a>) -> Result<Self> {
|
||||
fn parse(stream: &mut Stream<'a>, state: &ParserState) -> Result<Self> {
|
||||
let table_id = stream.read_sized(5)?;
|
||||
|
||||
let changed: u16 = if stream.read()? { stream.read()? } else { 1 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue