From c4a0c6b0c55c29163776574438ef0e720e32b9d3 Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Sat, 2 Sep 2023 21:52:43 +0300 Subject: [PATCH] fix --- src/fot/entity.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/fot/entity.rs b/src/fot/entity.rs index 03cd1ee..769bf46 100644 --- a/src/fot/entity.rs +++ b/src/fot/entity.rs @@ -12,27 +12,29 @@ pub enum EntityOrigin { World } -pub struct Entity { +// FString type should be reference + +pub struct Entity<'a> { origin: EntityOrigin, tag: Option, pub id: usize, pub flags: u32, pub type_idx: u16, - pub type_name: FString, + pub type_name: &'a FString, pub esh: ESH, enc_size: usize } -pub struct EntityOpt { +pub struct EntityOpt<'b> { pub origin: EntityOrigin, pub flags: u32, - pub type_idx: u16, - pub type_name: Option, + pub type_idx: u16, + pub type_name: Option<&'b FString>, } -impl Decoder for Entity { - type Opt = EntityOpt; - fn decode(raw: &Raw, offset: usize, _: usize, opt: Option) -> Result { +impl<'a> Decoder for Entity<'a> { + type Opt = EntityOpt<'a>; + fn decode(raw: &Raw, offset: usize, _: usize, opt: Option) -> Result> { let rd = ReadStream::new(raw, offset); let opt = match opt { Some(opt) => opt,