From fe2cb4e624ee83bbe2900f6ac9451f2efba04284 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 23 Feb 2025 15:54:17 -0500 Subject: [PATCH] Remove NameProperty This has the same memory layout as StringProperty, and we don't need to duplicate the work. --- src/lib.rs | 6 ++---- src/name_property.rs | 14 -------------- 2 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 src/name_property.rs diff --git a/src/lib.rs b/src/lib.rs index adb2441..922cf28 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,6 @@ mod common; pub mod float_property; pub mod int_property; pub mod map_property; -pub mod name_property; pub mod set_property; pub mod str_property; pub mod struct_property; @@ -17,7 +16,6 @@ use crate::bool_property::BoolProperty; use crate::float_property::FloatProperty; use crate::int_property::IntProperty; use crate::map_property::MapProperty; -use crate::name_property::NameProperty; use crate::set_property::SetProperty; use crate::str_property::StrProperty; use crate::struct_property::StructProperty; @@ -37,7 +35,7 @@ pub enum Property { #[br(magic = b"StrProperty\0")] String(StrProperty), #[br(magic = b"NameProperty\0")] - Name(NameProperty), + Name(StrProperty), #[br(magic = b"ArrayProperty\0")] Array(ArrayProperty), #[br(magic = b"MapProperty\0")] @@ -52,7 +50,7 @@ pub enum Property { #[br(import { magic: &str })] pub enum StringBasedProperty { #[br(pre_assert("NameProperty" == magic))] - Name(NameProperty), + Name(StrProperty), #[br(pre_assert("StructProperty" == magic))] Struct(StructProperty), #[br(pre_assert("FloatProperty" == magic))] diff --git a/src/name_property.rs b/src/name_property.rs deleted file mode 100644 index 314a10e..0000000 --- a/src/name_property.rs +++ /dev/null @@ -1,14 +0,0 @@ -use binrw::binrw; - -#[binrw] -#[derive(Debug)] -pub struct NameProperty { - #[br(temp)] - #[bw(ignore)] - #[br(pad_after = 5)] - pub property_name_length: u32, - #[br(count = property_name_length)] - #[bw(map = |x : &String | x.as_bytes())] - #[br(map = | x: Vec | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())] - pub property_name: String, -}