mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 18:24:05 +02:00
more usefull Debug for SendProp
This commit is contained in:
parent
2617d8a611
commit
a9a527fb5c
1 changed files with 13 additions and 7 deletions
|
|
@ -16,7 +16,7 @@ use serde::{Deserialize, Serialize};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::convert::{TryFrom, TryInto};
|
use std::convert::{TryFrom, TryInto};
|
||||||
use std::fmt::{self, Display, Formatter};
|
use std::fmt::{self, Debug, Display, Formatter};
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::ops::{BitOr, Deref};
|
use std::ops::{BitOr, Deref};
|
||||||
|
|
||||||
|
|
@ -635,11 +635,11 @@ impl PartialEq for SendPropValue {
|
||||||
impl fmt::Display for SendPropValue {
|
impl fmt::Display for SendPropValue {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
SendPropValue::Vector(vector) => vector.fmt(f),
|
SendPropValue::Vector(vector) => Display::fmt(vector, f),
|
||||||
SendPropValue::VectorXY(vector) => vector.fmt(f),
|
SendPropValue::VectorXY(vector) => Display::fmt(vector, f),
|
||||||
SendPropValue::Integer(int) => int.fmt(f),
|
SendPropValue::Integer(int) => Display::fmt(int, f),
|
||||||
SendPropValue::Float(float) => float.fmt(f),
|
SendPropValue::Float(float) => Display::fmt(float, f),
|
||||||
SendPropValue::String(string) => string.fmt(f),
|
SendPropValue::String(string) => Display::fmt(string, f),
|
||||||
SendPropValue::Array(array) => {
|
SendPropValue::Array(array) => {
|
||||||
write!(f, "[")?;
|
write!(f, "[")?;
|
||||||
for child in array {
|
for child in array {
|
||||||
|
|
@ -1169,7 +1169,7 @@ impl Display for SendPropIdentifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
|
||||||
#[derive(Debug, Clone, Display, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Display, PartialEq, Serialize, Deserialize)]
|
||||||
#[display("{index} = {value}")]
|
#[display("{index} = {value}")]
|
||||||
pub struct SendProp {
|
pub struct SendProp {
|
||||||
pub index: u32,
|
pub index: u32,
|
||||||
|
|
@ -1177,6 +1177,12 @@ pub struct SendProp {
|
||||||
pub value: SendPropValue,
|
pub value: SendPropValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Debug for SendProp {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "{} = {}", self.identifier, self.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn read_var_int(stream: &mut Stream, signed: bool) -> ReadResult<i32> {
|
pub fn read_var_int(stream: &mut Stream, signed: bool) -> ReadResult<i32> {
|
||||||
let abs_int = crate::demo::message::stringtable::read_var_int(stream)? as i32;
|
let abs_int = crate::demo::message::stringtable::read_var_int(stream)? as i32;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue