mirror of
https://github.com/azalea-rs/simdnbt.git
synced 2025-08-02 15:36:03 +00:00
derive Clone and PartialEq
This commit is contained in:
parent
b298444cdf
commit
837b5990e7
6 changed files with 11 additions and 11 deletions
|
@ -17,7 +17,7 @@ use super::{read_u32, CompoundTag, MAX_DEPTH};
|
|||
|
||||
/// A list of NBT tags of a single type.
|
||||
#[repr(u8)]
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, PartialEq)]
|
||||
pub enum ListTag<'a> {
|
||||
#[default]
|
||||
Empty = END_ID,
|
||||
|
|
|
@ -20,14 +20,14 @@ use crate::{
|
|||
use self::list::ListTag;
|
||||
|
||||
/// A complete NBT container. This contains a name and a compound tag.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Nbt<'a> {
|
||||
name: &'a Mutf8Str,
|
||||
tag: CompoundTag<'a>,
|
||||
}
|
||||
|
||||
/// A list of named tags. The order of the tags is preserved.
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, PartialEq)]
|
||||
pub struct CompoundTag<'a> {
|
||||
values: Vec<(&'a Mutf8Str, Tag<'a>)>,
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ impl<'a> CompoundTag<'a> {
|
|||
|
||||
/// A single NBT tag.
|
||||
#[repr(u8)]
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Tag<'a> {
|
||||
Byte(i8) = BYTE_ID,
|
||||
Short(i16) = SHORT_ID,
|
||||
|
|
|
@ -13,7 +13,7 @@ pub struct Mutf8Str {
|
|||
pub(crate) slice: [u8],
|
||||
}
|
||||
/// An owned M-UTF8 string.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||
pub struct Mutf8String {
|
||||
vec: Vec<u8>,
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use super::{read_u32, CompoundTag, MAX_DEPTH};
|
|||
|
||||
/// A list of NBT tags of a single type.
|
||||
#[repr(u8)]
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, Clone, PartialEq)]
|
||||
pub enum ListTag {
|
||||
#[default]
|
||||
Empty = END_ID,
|
||||
|
|
|
@ -20,7 +20,7 @@ use crate::{
|
|||
use self::list::ListTag;
|
||||
|
||||
/// A complete NBT container. This contains a name and a compound tag.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Nbt {
|
||||
name: Mutf8String,
|
||||
tag: CompoundTag,
|
||||
|
@ -64,7 +64,7 @@ impl Nbt {
|
|||
}
|
||||
|
||||
/// A list of named tags. The order of the tags is preserved.
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, Clone, PartialEq)]
|
||||
pub struct CompoundTag {
|
||||
values: Vec<(Mutf8String, Tag)>,
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ impl CompoundTag {
|
|||
if depth > MAX_DEPTH {
|
||||
return Err(ReadError::MaxDepthExceeded);
|
||||
}
|
||||
let mut values = Vec::with_capacity(4);
|
||||
let mut values = Vec::with_capacity(8);
|
||||
loop {
|
||||
let tag_type = data.read_u8().map_err(|_| ReadError::UnexpectedEof)?;
|
||||
if tag_type == END_ID {
|
||||
|
@ -360,7 +360,7 @@ impl CompoundTag {
|
|||
|
||||
/// A single NBT tag.
|
||||
#[repr(u8)]
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Tag {
|
||||
Byte(i8) = BYTE_ID,
|
||||
Short(i16) = SHORT_ID,
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::swap_endianness::{swap_endianness, swap_endianness_as_u8, SwappableNu
|
|||
|
||||
/// A list of numbers that's kept as big-endian in memory.
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct RawList<'a, T> {
|
||||
data: &'a [u8],
|
||||
_marker: PhantomData<T>,
|
||||
|
|
Loading…
Add table
Reference in a new issue