Skip to content

Commit 6a40fe2

Browse files
committed
Update to the newest flatbuffers spec
1 parent 1224bd1 commit 6a40fe2

File tree

6 files changed

+125
-114
lines changed

6 files changed

+125
-114
lines changed

Cargo.lock

Lines changed: 38 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rlbot-flatbuffers-py"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
edition = "2021"
55
description = "A Python module implemented in Rust for serializing and deserializing RLBot's flatbuffers"
66
repository = "https://github.com/VirxEC/rlbot-flatbuffers-py"
@@ -18,8 +18,8 @@ name = "rlbot_flatbuffers"
1818
crate-type = ["cdylib"]
1919

2020
[dependencies]
21-
pyo3 = "0.20.2"
22-
serde = "1.0.195"
21+
pyo3 = "0.20.3"
22+
serde = "1.0.197"
2323
flatbuffers = { git = "https://github.com/google/flatbuffers", branch = "master" }
2424
get-size = { version = "0.1.4", features = ["derive"] }
2525

build.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -696,16 +696,15 @@ impl PythonBindGenerator {
696696
let snake_case_name = &variable_info[2];
697697

698698
self.file_contents.push(Cow::Borrowed(""));
699+
self.file_contents
700+
.push(Cow::Owned(format!(" if {snake_case_name}.is_some() {{",)));
699701
self.file_contents.push(Cow::Owned(format!(
700-
" if {snake_case_name}.is_some() {{",
701-
)));
702-
self.file_contents.push(Cow::Owned(format!(
703-
" item_type = {}Type::{variable_name};",self.struct_name
702+
" item_type = {}Type::{variable_name};",
703+
self.struct_name
704704
)));
705705
self.file_contents.push(Cow::Borrowed(" }"));
706706
}
707707

708-
709708
self.write_str("");
710709
self.write_str(" Self {");
711710
self.write_str(" item_type,");
@@ -1040,15 +1039,14 @@ fn mod_rs_generator(type_data: &[(String, String, Vec<Vec<String>>)]) -> io::Res
10401039
}
10411040

10421041
fn class_names_txt_generator(type_data: &[(String, String, Vec<Vec<String>>)]) -> io::Result<()> {
1043-
let mut file_contents = vec!["[".to_string()];
1044-
1045-
for (_, type_name, _) in type_data {
1046-
file_contents.push(format!(" {type_name},"));
1047-
}
1042+
let class_names = type_data
1043+
.iter()
1044+
.map(|(_, type_name, _)| format!(" {type_name}"))
1045+
.collect::<Vec<_>>();
10481046

1049-
file_contents.push("]".to_string());
1047+
let file_contents = format!("[\n{}\n]", class_names.join(",\n"));
10501048

1051-
fs::write("classes.txt", file_contents.join("\n"))?;
1049+
fs::write("classes.txt", file_contents)?;
10521050

10531051
Ok(())
10541052
}

flatbuffers-schema

pytest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@
3333
ready_message = ReadyMessage(True, wants_game_messages=True)
3434
print(repr(ready_message))
3535
print(ready_message)
36+
37+
print(repr(StopCommand()))
38+
print(StopCommand(True))

0 commit comments

Comments
 (0)