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

derive Display where possible

This commit is contained in:
Robin Appelman 2019-08-27 21:43:46 +02:00
commit 66668e3e61
7 changed files with 47 additions and 91 deletions

View file

@ -6,6 +6,7 @@ use crate::demo::packet::datatable::{SendTable, SendTableName, ServerClass};
use crate::demo::parser::ParseBitSkip;
use crate::demo::sendprop::{SendProp, SendPropDefinition, SendPropValue};
use crate::{MalformedDemoError, Parse, ParseError, ParserState, ReadResult, Result, Stream};
use parse_display::Display;
use std::collections::HashMap;
use std::fmt;
use std::hint::unreachable_unchecked;
@ -13,15 +14,9 @@ use std::num::ParseIntError;
use std::rc::Rc;
use std::str::FromStr;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Display)]
pub struct EntityId(u32);
impl fmt::Display for EntityId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
impl From<u32> for EntityId {
fn from(num: u32) -> Self {
EntityId(num)