From 42055ae6a98dadac0c0310fd970b15bcd7b80205 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Fri, 4 Aug 2023 00:21:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99=E5=8F=88=E4=B8=80=E9=81=8D?= =?UTF-8?q?=EF=BC=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ src/data.rs | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9bab3f8..8f93726 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,7 @@ nbt解析器 by shenjack writen in rust! + +感谢 @神楽坂柚咲/伊欧/langyo + +在编写过程中的帮助( diff --git a/src/data.rs b/src/data.rs index f8fafbd..861dc36 100644 --- a/src/data.rs +++ b/src/data.rs @@ -1,5 +1,7 @@ +use std::cell::RefCell; use std::collections::HashMap; use std::io::{Cursor, Read, Seek, SeekFrom}; +use std::rc::Rc; use std::sync::Arc; /// NBT 里除了字符串的长度量都是 i32 @@ -16,7 +18,7 @@ pub type Reader<'a> = Cursor<&'a [u8]>; #[derive(Debug, Clone)] pub enum NbtItem { Value(NbtValue), - Array(NbtList), + Array(NbtList), } /// 一个 NBT list 的基本素养 @@ -40,12 +42,16 @@ pub trait NbtListTrait { } /// 通过范型实现的 NBT List (其实包括了 NbtCompound) -#[derive(Debug, Clone)] -pub struct NbtList { - /// 内容 - pub value: T, +// #[derive(Debug, Clone)] +// pub struct NbtList { +// /// 内容 +// pub value: T, +// } +pub enum NbtList { + BoolArray(Rc>>) } + #[allow(unused)] impl NbtList where @@ -168,7 +174,7 @@ where [0x07] => { for _ in 0..len { for _ in 0..len { - vec.push(NbtItem::Array(NbtList::>::from_reader(value))); + vec.push(NbtItem::Array( todo!() )); } } }