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,