Fix backend list parsing
This commit is contained in:
parent
c6d1cdecc7
commit
2d9b9dd94f
@ -55,10 +55,6 @@ pub enum Container {
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
#[serde(untagged)]
|
||||
pub enum Switch {
|
||||
Empty {
|
||||
#[serde(rename = "compareTo")]
|
||||
compare_to: String,
|
||||
},
|
||||
Value {
|
||||
#[serde(rename = "compareTo")]
|
||||
compare_to: String,
|
||||
@ -69,15 +65,15 @@ pub enum Switch {
|
||||
compare_to: String,
|
||||
fields: LinkedHashMap<String, Vec<Data>>,
|
||||
},
|
||||
Empty {
|
||||
#[serde(rename = "compareTo")]
|
||||
compare_to: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
#[serde(untagged)]
|
||||
pub enum List {
|
||||
Empty {
|
||||
#[serde(rename = "countType")]
|
||||
count_type: String,
|
||||
},
|
||||
Value {
|
||||
#[serde(rename = "countType")]
|
||||
count_type: String,
|
||||
@ -90,6 +86,10 @@ pub enum List {
|
||||
#[serde(rename = "type")]
|
||||
list_type: Vec<Data>,
|
||||
},
|
||||
Empty {
|
||||
#[serde(rename = "countType")]
|
||||
count_type: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Eq)]
|
||||
|
@ -28,7 +28,7 @@ pub fn main() {
|
||||
let protocol_data_file =
|
||||
File::open(protocol_data_file_name).expect("Failed to open protocol data file");
|
||||
|
||||
let protocol_input: backend::ProtocolHandler =
|
||||
let protocol_handler: backend::ProtocolHandler =
|
||||
serde_json::from_reader(protocol_data_file).expect("Failed to parse protocol data");
|
||||
|
||||
let mappings = CodeMappings {};
|
||||
@ -38,7 +38,7 @@ pub fn main() {
|
||||
transformers::transform_protocol(
|
||||
&mappings,
|
||||
frontend::State::Handshake,
|
||||
&protocol_input.handshaking,
|
||||
&protocol_handler.handshaking,
|
||||
),
|
||||
frontend::State::Handshake,
|
||||
),
|
||||
@ -46,7 +46,7 @@ pub fn main() {
|
||||
transformers::transform_protocol(
|
||||
&mappings,
|
||||
frontend::State::Status,
|
||||
&protocol_input.status,
|
||||
&protocol_handler.status,
|
||||
),
|
||||
frontend::State::Status,
|
||||
),
|
||||
@ -54,7 +54,7 @@ pub fn main() {
|
||||
transformers::transform_protocol(
|
||||
&mappings,
|
||||
frontend::State::Login,
|
||||
&protocol_input.login,
|
||||
&protocol_handler.login,
|
||||
),
|
||||
frontend::State::Login,
|
||||
),
|
||||
@ -62,7 +62,7 @@ pub fn main() {
|
||||
transformers::transform_protocol(
|
||||
&mappings,
|
||||
frontend::State::Game,
|
||||
&protocol_input.game,
|
||||
&protocol_handler.game,
|
||||
),
|
||||
frontend::State::Game,
|
||||
),
|
||||
@ -73,6 +73,7 @@ pub fn main() {
|
||||
"protocol/src/packet/{}.rs",
|
||||
state.to_string().to_lowercase()
|
||||
);
|
||||
|
||||
let file = File::create(file_name).expect("Failed to create file");
|
||||
|
||||
frontend::generate_rust_file(&protocol, &template_engine, &file)
|
||||
|
Loading…
x
Reference in New Issue
Block a user