Refactor NBT data cloning

This commit is contained in:
shenjack 2024-01-16 20:51:44 +08:00
parent f8a001e38d
commit f512b4a5c2
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -168,9 +168,9 @@ fn read_test(in_data: Vec<u8>) {
println!("data: {:?}", data); println!("data: {:?}", data);
let data = in_data.clone(); let data = in_data.clone();
let data2 = in_data.clone(); // let data2 = in_data.clone();
let data3 = in_data.clone(); // let data3 = in_data.clone();
let data4 = in_data.clone(); // let data4 = in_data.clone();
std::thread::sleep(std::time::Duration::from_secs(1)); std::thread::sleep(std::time::Duration::from_secs(1));
test_lib!( test_lib!(
{ {
@ -181,19 +181,19 @@ fn read_test(in_data: Vec<u8>) {
test_lib!( test_lib!(
{ {
let _nbt_data = shen_nbt2::Value::from_vec(data2); let _nbt_data = shen_nbt2::Value::from_vec(data.as_slice().to_vec());
}, "nbt v2", len }, "nbt v2", len
); );
test_lib!( test_lib!(
{ {
let _nbt_data = shen_nbt3::Value::from_vec(data3); let _nbt_data = shen_nbt3::Value::from_vec(data.as_slice().to_vec());
}, "nbt v3", len }, "nbt v3", len
); );
test_lib!( test_lib!(
{ {
let _nbt_data = shen_nbt4::Value::from_vec(data4); let _nbt_data = shen_nbt4::Value::from_vec(data.as_slice().to_vec());
}, "nbt v4", len }, "nbt v4", len
); );