Skip to content

Commit

Permalink
Update to new spec
Browse files Browse the repository at this point in the history
  • Loading branch information
VirxEC committed Jan 30, 2024
1 parent e4b964e commit c894494
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rlbot-flatbuffers-py"
version = "0.1.2"
version = "0.1.3"
edition = "2021"
description = "A Python module implemented in Rust for serializing and deserializing RLBot's flatbuffers"
repository = "https://github.com/VirxEC/rlbot-flatbuffers-py"
Expand Down
7 changes: 4 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct PythonBindGenerator {
}

impl PythonBindGenerator {
const BASE_TYPES: [&'static str; 5] = ["bool", "i32", "f32", "String", "u8"];
const BASE_TYPES: [&'static str; 6] = ["bool", "i32", "u32", "f32", "String", "u8"];

fn new(path: &Path) -> Option<Self> {
// get the filename without the extension
Expand Down Expand Up @@ -1044,6 +1044,7 @@ fn pyi_generator(type_data: &[(String, String, Vec<Vec<String>>)]) -> io::Result
let primitive_map = [
("bool", "bool"),
("i32", "int"),
("u32", "int"),
("f32", "float"),
("String", "str"),
("u8", "int"),
Expand Down Expand Up @@ -1127,7 +1128,7 @@ fn pyi_generator(type_data: &[(String, String, Vec<Vec<String>>)]) -> io::Result

if type_name == "bool" {
file_contents.push(Cow::Owned(format!(" {variable_name}: Optional[bool]")));
} else if type_name == "i32" {
} else if type_name == "i32" || type_name == "u32" {
file_contents.push(Cow::Owned(format!(" {variable_name}: Optional[int]")));
} else if type_name == "f32" {
file_contents.push(Cow::Owned(format!(" {variable_name}: Optional[float]")));
Expand Down Expand Up @@ -1170,7 +1171,7 @@ fn pyi_generator(type_data: &[(String, String, Vec<Vec<String>>)]) -> io::Result

let default_value = match variable_type.as_str() {
"bool" => Cow::Borrowed("False"),
"i32" | "f32" | "u8" => Cow::Borrowed("0"),
"i32" | "u32" | "f32" | "u8" => Cow::Borrowed("0"),
"String" => Cow::Borrowed("\"\""),
t => {
if t.starts_with("Vec<") {
Expand Down
2 changes: 1 addition & 1 deletion flatbuffers-schema
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pynamedmodule! {
GameStateType,
GameSpeedOption,
ScoreInfo,
BotSpawnIndex,
MessagePacket,
DemolishOption,
Vector3Partial,
Expand Down

0 comments on commit c894494

Please sign in to comment.