1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 10:44:07 +02:00

remove unknown entity

The caller already has the RawEntity, there does not need to be any special values.
This commit is contained in:
Quaternions 2025-02-14 09:33:40 -08:00
commit 3858ba46de

View file

@ -112,13 +112,8 @@ impl<'a> RawEntity<'a> {
T::parse(self.prop(key)?)
}
pub fn parse(&self) -> Result<Entity<'a>, EntityParseError> {
match vdf_reader::from_str(self.buf) {
Ok(entity) => Ok(entity),
Err(VdfError::UnknownVariant(_)) => Ok(Entity::Unknown(self.clone())),
// todo
Err(_) => Err(EntityParseError::NoSuchProperty("unknown serde error")),
}
pub fn parse(&self) -> Result<Entity<'a>, VdfError> {
vdf_reader::from_str(self.buf)
}
}
@ -252,7 +247,7 @@ impl<'de> Deserialize<'de> for LightColor {
pub use typed::*;
mod typed {
use crate::{Angles, Color, LightColor, RawEntity, Vector};
use crate::{Angles, Color, LightColor, Vector};
use serde::{Deserialize, Deserializer};
#[derive(Debug, Clone, Deserialize)]
@ -370,8 +365,6 @@ mod typed {
#[serde(rename = "func_occluder")]
#[serde(borrow)]
Occluder(Occluder<'a>),
#[serde(skip)]
Unknown(RawEntity<'a>),
}
#[derive(Debug, Clone, Deserialize)]