This commit is contained in:
shenjack 2024-01-12 18:07:04 +08:00
parent af5fb1b5ef
commit 928953d58e
Signed by: shenjack
GPG Key ID: 7B1134A979775551
10 changed files with 42 additions and 98 deletions

98
Cargo.lock generated
View File

@ -1,98 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cesu8"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
[[package]]
name = "fastnbt"
version = "2.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3369bd70629bccfda7e344883c9ae3ab7f3b10a357bcf8b0f69caa7256bcf188"
dependencies = [
"byteorder",
"cesu8",
"serde",
"serde_bytes",
]
[[package]]
name = "nbt-rust"
version = "0.1.0"
dependencies = [
"fastnbt",
]
[[package]]
name = "proc-macro2"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
dependencies = [
"proc-macro2",
]
[[package]]
name = "serde"
version = "1.0.181"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d3e73c93c3240c0bda063c239298e633114c69a888c3e37ca8bb33f343e9890"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_bytes"
version = "0.11.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff"
dependencies = [
"serde",
]
[[package]]
name = "serde_derive"
version = "1.0.181"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be02f6cb0cd3a5ec20bbcfbcbd749f57daddb1a0882dc2e46a6c236c90b977ed"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "syn"
version = "2.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"

View File

8
v2/Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "shen-nbt2"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

29
v2/src/data_struct.rs Normal file
View File

@ -0,0 +1,29 @@
use std::collections::HashMap;
/// NBT 里除了字符串的长度量都是 i32
pub type NbtLength = i32;
/// NBT 里的字符串独树一帜的把自己的长度用一个u32表示
/// 不如说为啥别的不用 u32 呢
pub type StringLength = u16;
pub struct RawData<'data> {
pub raw_data: &'data [u8],
}
pub enum Value<'value> {
Byte(RawData<'value>),
Short(RawData<'value>),
Int(RawData<'value>),
Long(RawData<'value>),
Float(RawData<'value>),
Double(RawData<'value>),
String(RawData<'value>),
ByteArray(RawData<'value>),
IntArray(RawData<'value>),
LongArray(RawData<'value>),
List(Vec<Value<'value>>),
Compound(HashMap<&'value str, Value<'value>>),
}

5
v2/src/main.rs Normal file
View File

@ -0,0 +1,5 @@
mod data_struct;
fn main() {
println!("Hello, world!");
}