From e36ae4601df41bbe0df4b801832a06d99ca9d639 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 26 Nov 2023 12:27:18 +0100 Subject: [PATCH] world: add Eq + Ord to all block entity types --- src/world/block_entity.rs | 8 ++++---- src/world/json_text.rs | 4 ++-- src/world/sign.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/world/block_entity.rs b/src/world/block_entity.rs index 65d95e4..9e60a23 100644 --- a/src/world/block_entity.rs +++ b/src/world/block_entity.rs @@ -8,7 +8,7 @@ use super::{ }; /// Kind of sign block -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] #[serde(rename_all = "snake_case")] pub enum SignKind { /// Standing or attached sign @@ -18,7 +18,7 @@ pub enum SignKind { } /// Processed sign data -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] pub struct Sign { /// The kind of the sign pub kind: SignKind, @@ -45,7 +45,7 @@ impl Sign { } /// Data for different kinds of [BlockEntity] -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] #[serde(tag = "type", rename_all = "snake_case")] pub enum BlockEntityData { /// A sign block @@ -53,7 +53,7 @@ pub enum BlockEntityData { } /// A processed block entity -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] pub struct BlockEntity { /// Global X coordinate pub x: i32, diff --git a/src/world/json_text.rs b/src/world/json_text.rs index a9c1f13..0f72dcc 100644 --- a/src/world/json_text.rs +++ b/src/world/json_text.rs @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize}; /// is handled by [DeserializedText]. /// /// Formatting that is not set in a node is inherited from the parent. -#[derive(Debug, Serialize, Deserialize, Default)] +#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Eq, PartialOrd, Ord)] pub struct FormattedText { #[serde(default)] /// Text content @@ -77,7 +77,7 @@ impl From for FormattedTextTree { } /// List of [FormattedText] -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] pub struct FormattedTextList(pub Vec); impl FormattedTextList { diff --git a/src/world/sign.rs b/src/world/sign.rs index e53be87..43cac47 100644 --- a/src/world/sign.rs +++ b/src/world/sign.rs @@ -79,7 +79,7 @@ impl BlockEntitySignExt for de::BlockEntitySign { } } -#[derive(Debug, Default, Serialize, Deserialize)] +#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] /// Deserialized and linearized sign text pub struct SignText(pub Vec);