actually set up serde correctly

This commit is contained in:
endernon 2024-11-23 14:19:34 +00:00
parent b6b54ffd6e
commit cf2fa3030a
3 changed files with 85 additions and 29 deletions

60
Cargo.lock generated
View file

@ -4,4 +4,62 @@ version = 3
[[package]]
name = "mcmeta-parser"
version = "0.1.0"
version = "0.4.0"
dependencies = [
"serde",
]
[[package]]
name = "proc-macro2"
version = "1.0.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "serde"
version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "syn"
version = "2.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"

View file

@ -9,4 +9,4 @@ version = "0.4.0"
edition = "2021"
[dependencies]
serde="1.0.215"
serde={ version = "1.0.215", features = ["derive"] }

View file

@ -1,66 +1,64 @@
use serde::{Serialize,Deserialize};
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
#[serde()]
pub struct McMeta {
pub pack: McMeta_Pack,
pub features: McMeta_Features,
pub filter: Option<McMeta_Filter>,
pub overlays: Option<McMeta_Overlays>,
pub language: Option<Vec<McMeta_Language_Vec>>
pub struct Mcmeta {
pub pack: McmetaPack,
pub features: McmetaFeatures,
pub filter: Option<McmetaFilter>,
pub overlays: Option<McmetaOverlays>,
pub language: Option<Vec<McmetaLanguage>>
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Pack {
pub description: Vec<McMeta_Pack_Description_Vec>,
pub struct McmetaPack {
pub description: Vec<McmetaPackDescription>,
pub pack_format: u8,
pub supported_formats: Option<McMeta_Pack_SupportedFormats>
pub supported_formats: Option<McmetaPackSupportedformats>
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Pack_Description_Vec {
pub struct McmetaPackDescription {
pub text: String,
pub color: Option<String>
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Pack_SupportedFormats {
pub struct McmetaPackSupportedformats {
pub min_inclusive: u8,
pub max_inclusive: u8
}
// I don't actually know wtf this looks like. I'm guessing based on minecraft wiki
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Features {
pub struct McmetaFeatures {
pub enabled: Vec<String>
}
// I don't what this looks like either
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Filter {
pub block: Vec<McMeta_Filter_Block_Vec>
pub struct McmetaFilter {
pub block: Vec<McmetaFilterBlock>
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Filter_Block_Vec {
pub struct McmetaFilterBlock {
pub Namespace: String,
pub Path: String
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Overlays {
pub entries: Vec<McMeta_Overlays_Entries>
pub struct McmetaOverlays {
pub entries: Vec<McmetaOverlaysEntries>
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Overlays_Entries {
pub formats: McMeta_Overlays_Entries_Formats,
pub struct McmetaOverlaysEntries {
pub formats: McmetaOverlaysEntriesFormats,
pub directory: String
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Overlays_Entries_Formats {
pub struct McmetaOverlaysEntriesFormats {
pub min_inclusive: u8,
pub max_inclusive: u8
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
pub struct McMeta_Language_Vec {
pub struct McmetaLanguage {
pub name: String,
pub region: String,
pub bidirectional: bool