treewide: update to bincode 2

Consistently use bincode's Encode/Decode to avoid issues with
incompatible serde features. Support for storing some temporary files as
JSON is removed.

The size of the "processed" directory is reduced by ~8% with the new
default encoding of bincode 2. Performance is more or less unaffected.
This commit is contained in:
Matthias Schiffer 2025-03-12 20:34:26 +01:00
parent 404ad74235
commit 53a0f24600
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
16 changed files with 133 additions and 81 deletions

View file

@ -1,7 +1,8 @@
//! Processing of block entity data
use bincode::{Decode, Encode};
use minedmap_resource::{BlockFlag, BlockType};
use serde::{Deserialize, Serialize};
use serde::Serialize;
use super::{
de,
@ -9,7 +10,7 @@ use super::{
};
/// Kind of sign block
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum SignKind {
/// Standing sign
@ -23,7 +24,7 @@ pub enum SignKind {
}
/// Processed sign data
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, Serialize)]
pub struct Sign {
/// The kind of the sign
pub kind: SignKind,
@ -54,7 +55,7 @@ impl Sign {
}
/// Data for different kinds of [BlockEntity]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, Serialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum BlockEntityData {
/// A sign block
@ -62,7 +63,7 @@ pub enum BlockEntityData {
}
/// A processed block entity
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, Serialize)]
pub struct BlockEntity {
/// Global X coordinate
pub x: i32,