actually set up serde correctly
This commit is contained in:
parent
b6b54ffd6e
commit
cf2fa3030a
3 changed files with 85 additions and 29 deletions
60
Cargo.lock
generated
60
Cargo.lock
generated
|
@ -4,4 +4,62 @@ version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mcmeta-parser"
|
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"
|
||||||
|
|
|
@ -9,4 +9,4 @@ version = "0.4.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde="1.0.215"
|
serde={ version = "1.0.215", features = ["derive"] }
|
||||||
|
|
44
src/lib.rs
44
src/lib.rs
|
@ -1,66 +1,64 @@
|
||||||
use serde::{Serialize,Deserialize};
|
use serde::{Serialize,Deserialize};
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
#[serde()]
|
pub struct Mcmeta {
|
||||||
pub struct McMeta {
|
pub pack: McmetaPack,
|
||||||
pub pack: McMeta_Pack,
|
pub features: McmetaFeatures,
|
||||||
pub features: McMeta_Features,
|
pub filter: Option<McmetaFilter>,
|
||||||
pub filter: Option<McMeta_Filter>,
|
pub overlays: Option<McmetaOverlays>,
|
||||||
pub overlays: Option<McMeta_Overlays>,
|
pub language: Option<Vec<McmetaLanguage>>
|
||||||
pub language: Option<Vec<McMeta_Language_Vec>>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Pack {
|
pub struct McmetaPack {
|
||||||
pub description: Vec<McMeta_Pack_Description_Vec>,
|
pub description: Vec<McmetaPackDescription>,
|
||||||
pub pack_format: u8,
|
pub pack_format: u8,
|
||||||
pub supported_formats: Option<McMeta_Pack_SupportedFormats>
|
pub supported_formats: Option<McmetaPackSupportedformats>
|
||||||
}
|
}
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Pack_Description_Vec {
|
pub struct McmetaPackDescription {
|
||||||
pub text: String,
|
pub text: String,
|
||||||
pub color: Option<String>
|
pub color: Option<String>
|
||||||
}
|
}
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Pack_SupportedFormats {
|
pub struct McmetaPackSupportedformats {
|
||||||
pub min_inclusive: u8,
|
pub min_inclusive: u8,
|
||||||
pub max_inclusive: u8
|
pub max_inclusive: u8
|
||||||
}
|
}
|
||||||
|
|
||||||
// I don't actually know wtf this looks like. I'm guessing based on minecraft wiki
|
// I don't actually know wtf this looks like. I'm guessing based on minecraft wiki
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Features {
|
pub struct McmetaFeatures {
|
||||||
pub enabled: Vec<String>
|
pub enabled: Vec<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
// I don't what this looks like either
|
// I don't what this looks like either
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Filter {
|
pub struct McmetaFilter {
|
||||||
pub block: Vec<McMeta_Filter_Block_Vec>
|
pub block: Vec<McmetaFilterBlock>
|
||||||
}
|
}
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Filter_Block_Vec {
|
pub struct McmetaFilterBlock {
|
||||||
pub Namespace: String,
|
pub Namespace: String,
|
||||||
pub Path: String
|
pub Path: String
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Overlays {
|
pub struct McmetaOverlays {
|
||||||
pub entries: Vec<McMeta_Overlays_Entries>
|
pub entries: Vec<McmetaOverlaysEntries>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Overlays_Entries {
|
pub struct McmetaOverlaysEntries {
|
||||||
pub formats: McMeta_Overlays_Entries_Formats,
|
pub formats: McmetaOverlaysEntriesFormats,
|
||||||
pub directory: String
|
pub directory: String
|
||||||
}
|
}
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Overlays_Entries_Formats {
|
pub struct McmetaOverlaysEntriesFormats {
|
||||||
pub min_inclusive: u8,
|
pub min_inclusive: u8,
|
||||||
pub max_inclusive: u8
|
pub max_inclusive: u8
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone)]
|
||||||
pub struct McMeta_Language_Vec {
|
pub struct McmetaLanguage {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub region: String,
|
pub region: String,
|
||||||
pub bidirectional: bool
|
pub bidirectional: bool
|
||||||
|
|
Loading…
Reference in a new issue