This commit is contained in:
mykola2312 2023-09-02 21:52:43 +03:00
parent 7f0be36c30
commit c4a0c6b0c5

View file

@ -12,27 +12,29 @@ pub enum EntityOrigin {
World
}
pub struct Entity {
// FString type should be reference
pub struct Entity<'a> {
origin: EntityOrigin,
tag: Option<Tag>,
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<FString>,
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<Self::Opt>) -> Result<Self> {
impl<'a> Decoder for Entity<'a> {
type Opt = EntityOpt<'a>;
fn decode(raw: &Raw, offset: usize, _: usize, opt: Option<Self::Opt>) -> Result<Entity<'a>> {
let rd = ReadStream::new(raw, offset);
let opt = match opt {
Some(opt) => opt,