mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-04 10:34:11 +02:00
derive Display where possible
This commit is contained in:
parent
88d2a05d62
commit
66668e3e61
7 changed files with 47 additions and 91 deletions
|
|
@ -4,6 +4,7 @@ use crate::{MalformedDemoError, ParseError, Result};
|
|||
|
||||
pub use super::gameevent_gen::{GameEvent, GameEventType};
|
||||
use crate::demo::message::gameevent::GameEventTypeId;
|
||||
use parse_display::Display;
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt;
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ pub struct GameEventEntry {
|
|||
pub kind: GameEventValueType,
|
||||
}
|
||||
|
||||
#[derive(BitRead, Debug, Clone, Copy, PartialEq)]
|
||||
#[derive(BitRead, Debug, Clone, Copy, PartialEq, Display)]
|
||||
#[discriminant_bits = 3]
|
||||
pub enum GameEventValueType {
|
||||
None = 0,
|
||||
|
|
@ -54,21 +55,6 @@ pub enum GameEventValueType {
|
|||
Local = 7,
|
||||
}
|
||||
|
||||
impl fmt::Display for GameEventValueType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
GameEventValueType::None => write!(f, "None"),
|
||||
GameEventValueType::String => write!(f, "String"),
|
||||
GameEventValueType::Float => write!(f, "Float"),
|
||||
GameEventValueType::Long => write!(f, "Long"),
|
||||
GameEventValueType::Short => write!(f, "Short"),
|
||||
GameEventValueType::Byte => write!(f, "Byte"),
|
||||
GameEventValueType::Boolean => write!(f, "Boolean"),
|
||||
GameEventValueType::Local => write!(f, "Local"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum GameEventValue {
|
||||
String(String),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue