diff --git a/Cargo.lock b/Cargo.lock index 77a26c8..cb94062 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,9 +64,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.74" +version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" dependencies = [ "addr2line", "cfg-if", @@ -85,9 +85,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bumpalo" @@ -103,9 +103,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.19" +version = "1.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362" +checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7" dependencies = [ "shlex", ] @@ -137,17 +137,11 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - [[package]] name = "derive-where" -version = "1.2.7" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" +checksum = "e73f2692d4bd3cac41dca28934a39894200c9fabf49586d77d0e5954af1d7902" dependencies = [ "proc-macro2", "quote", @@ -199,6 +193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" dependencies = [ "crc32fast", + "libz-rs-sys", "miniz_oxide", ] @@ -287,9 +282,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "js-sys", @@ -300,9 +295,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "js-sys", @@ -320,9 +315,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" [[package]] name = "heck" @@ -391,11 +386,10 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.5" +version = "0.27.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +checksum = "03a01595e11bdcec50946522c32dde3fc6914743000a68b93000965f2f02406d" dependencies = [ - "futures-util", "http", "hyper", "hyper-util", @@ -404,14 +398,14 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "webpki-roots", + "webpki-roots 1.0.0", ] [[package]] name = "hyper-util" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" +checksum = "cf9f1e950e0d9d1d3c47184416723cf29c0d1f93bd8cccf37e4beb6b44f31710" dependencies = [ "bytes", "futures-channel", @@ -429,21 +423,22 @@ dependencies = [ [[package]] name = "icu_collections" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" dependencies = [ "displaydoc", + "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] -name = "icu_locid" -version = "1.5.0" +name = "icu_locale_core" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" dependencies = [ "displaydoc", "litemap", @@ -452,31 +447,11 @@ dependencies = [ "zerovec", ] -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" - [[package]] name = "icu_normalizer" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" dependencies = [ "displaydoc", "icu_collections", @@ -484,67 +459,54 @@ dependencies = [ "icu_properties", "icu_provider", "smallvec", - "utf16_iter", - "utf8_iter", - "write16", "zerovec", ] [[package]] name = "icu_normalizer_data" -version = "1.5.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] name = "icu_properties" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" dependencies = [ "displaydoc", "icu_collections", - "icu_locid_transform", + "icu_locale_core", "icu_properties_data", "icu_provider", - "tinystr", + "potential_utf", + "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] name = "icu_provider" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" dependencies = [ "displaydoc", - "icu_locid", - "icu_provider_macros", + "icu_locale_core", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", + "zerotrie", "zerovec", ] -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "idna" version = "1.0.3" @@ -558,9 +520,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", @@ -612,21 +574,24 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.171" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] -name = "litemap" -version = "0.7.5" +name = "libz-rs-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "6489ca9bd760fe9642d7644e827b0c9add07df89857b0416ee15c1cc1a3b8c5a" +dependencies = [ + "zlib-rs", +] [[package]] -name = "lockfree-object-pool" -version = "0.1.6" +name = "litemap" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" [[package]] name = "log" @@ -634,6 +599,12 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + [[package]] name = "manyhow" version = "0.11.4" @@ -689,13 +660,13 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -737,6 +708,15 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" +[[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -759,20 +739,19 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17da310086b068fbdcefbba30aeb3721d5bb9af8db4987d6735b2183ca567229" +checksum = "f239d656363bcee73afef85277f1b281e8ac6212a1d42aa90e55b90ed43c47a4" dependencies = [ - "cfg-if", "indoc", "libc", "memoffset", @@ -786,9 +765,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27165889bd793000a098bb966adc4300c312497ea25cf7a690a9f0ac5aa5fc1" +checksum = "755ea671a1c34044fa165247aaf6f419ca39caa6003aee791a0df2713d8f1b6d" dependencies = [ "once_cell", "target-lexicon", @@ -796,9 +775,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05280526e1dbf6b420062f3ef228b78c0c54ba94e157f5cb724a609d0f2faabc" +checksum = "fc95a2e67091e44791d4ea300ff744be5293f394f1bafd9f78c080814d35956e" dependencies = [ "libc", "pyo3-build-config", @@ -806,9 +785,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c3ce5686aa4d3f63359a5100c62a127c9f15e8398e5fdeb5deef1fed5cd5f44" +checksum = "a179641d1b93920829a62f15e87c0ed791b6c8db2271ba0fd7c2686090510214" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -818,9 +797,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4cf6faa0cbfb0ed08e89beb8103ae9724eb4750e3a78084ba4017cbe94f3855" +checksum = "9dff85ebcaab8c441b0e3f7ae40a6963ecea8a9f5e74f647e33fcf5ec9a1e89e" dependencies = [ "heck", "proc-macro2", @@ -831,9 +810,9 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.7" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3bd15a6f2967aef83887dcb9fec0014580467e33720d073560cf015a5683012" +checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8" dependencies = [ "bytes", "cfg_aliases", @@ -851,12 +830,13 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.10" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b820744eb4dc9b57a3398183639c511b5a26d2ed702cedd3febaa1393caa22cc" +checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e" dependencies = [ "bytes", - "getrandom 0.3.2", + "getrandom 0.3.3", + "lru-slab", "rand", "ring", "rustc-hash", @@ -871,16 +851,16 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "541d0f57c6ec747a90738a52741d3221f7960e8ac2f0ff4b1a63680e033b4ab5" +checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842" dependencies = [ "cfg_aliases", "libc", "once_cell", "socket2", "tracing", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -922,13 +902,12 @@ checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" [[package]] name = "rand" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" dependencies = [ "rand_chacha", "rand_core", - "zerocopy", ] [[package]] @@ -947,7 +926,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.2", + "getrandom 0.3.3", ] [[package]] @@ -990,7 +969,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.26.11", "windows-registry", ] @@ -1002,15 +981,15 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.15", + "getrandom 0.2.16", "libc", "untrusted", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "rlbot_flatbuffers" -version = "0.16.1" +version = "0.17.0" dependencies = [ "flatbuffers", "get-size", @@ -1043,9 +1022,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.26" +version = "0.23.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0" +checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321" dependencies = [ "once_cell", "ring", @@ -1066,18 +1045,19 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" dependencies = [ "web-time", + "zeroize", ] [[package]] name = "rustls-webpki" -version = "0.103.1" +version = "0.103.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" dependencies = [ "ring", "rustls-pki-types", @@ -1086,9 +1066,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "ryu" @@ -1180,7 +1160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1197,9 +1177,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -1217,9 +1197,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", @@ -1254,9 +1234,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" dependencies = [ "displaydoc", "zerovec", @@ -1279,9 +1259,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.44.2" +version = "1.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" dependencies = [ "backtrace", "bytes", @@ -1289,7 +1269,7 @@ dependencies = [ "mio", "pin-project-lite", "socket2", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1383,12 +1363,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - [[package]] name = "utf8_iter" version = "1.0.4" @@ -1512,9 +1486,18 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.8" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.0", +] + +[[package]] +name = "webpki-roots" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" +checksum = "2853738d1cc4f2da3a225c18ec6c3721abb31961096e9dbf5ab35fa88b19cfdb" dependencies = [ "rustls-pki-types", ] @@ -1538,9 +1521,9 @@ dependencies = [ [[package]] name = "windows-result" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ "windows-link", ] @@ -1563,6 +1546,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -1700,23 +1692,17 @@ dependencies = [ "bitflags", ] -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - [[package]] name = "writeable" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "yoke" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "serde", "stable_deref_trait", @@ -1726,9 +1712,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", @@ -1738,18 +1724,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", @@ -1783,11 +1769,22 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + [[package]] name = "zerovec" -version = "0.10.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" dependencies = [ "yoke", "zerofrom", @@ -1796,9 +1793,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", @@ -1807,29 +1804,32 @@ dependencies = [ [[package]] name = "zip" -version = "2.6.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744" +checksum = "153a6fff49d264c4babdcfa6b4d534747f520e56e8f0f384f3b808c4b64cc1fd" dependencies = [ "arbitrary", "crc32fast", - "crossbeam-utils", "flate2", "indexmap", "memchr", "zopfli", ] +[[package]] +name = "zlib-rs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "868b928d7949e09af2f6086dfc1e01936064cc7a819253bce650d4e2a2d63ba8" + [[package]] name = "zopfli" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +checksum = "edfc5ee405f504cd4984ecc6f14d02d55cfda60fa4b689434ef4102aae150cd7" dependencies = [ "bumpalo", "crc32fast", - "lockfree-object-pool", "log", - "once_cell", "simd-adler32", ] diff --git a/Cargo.toml b/Cargo.toml index ab4e0da..9dbffd1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rlbot_flatbuffers" -version = "0.16.1" +version = "0.17.0" edition = "2024" description = "A Python module implemented in Rust for serializing and deserializing RLBot's flatbuffers" repository = "https://github.com/VirxEC/rlbot_flatbuffers_py" @@ -18,7 +18,7 @@ all = "warn" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.24.0", features = [] } +pyo3 = "0.25.0" serde = "1.0.217" flatbuffers = "=25.2.10" # get-size appears to be unmaintained but it's too useful here @@ -27,7 +27,7 @@ get-size = { git = "https://github.com/VirxEC/get-size", branch = "update", feat [build-dependencies] reqwest = { version = "0.12.15", features = ["blocking", "rustls-tls"], default-features = false } -zip = { version = "2.6.1", features = ["deflate"], default-features = false } +zip = { version = "4.0.0", features = ["deflate"], default-features = false } [profile.dev] opt-level = 2 diff --git a/codegen/enums.rs b/codegen/enums.rs index 89d80be..9c302f9 100644 --- a/codegen/enums.rs +++ b/codegen/enums.rs @@ -64,7 +64,7 @@ impl EnumBindGenerator { Cow::Borrowed("use crate::{flat_err_to_py, generated::rlbot::flat};"), Cow::Borrowed("use flatbuffers::root;"), Cow::Borrowed( - "use pyo3::{exceptions::PyValueError, pyclass, pymethods, types::PyBytes, Bound, PyResult, Python};", + "use pyo3::{Bound, PyResult, Python, exceptions::PyValueError, pyclass, pymethods, types::PyBytes};", ), Cow::Borrowed(""), ]; diff --git a/codegen/main.rs b/codegen/main.rs index 00443bc..be155b6 100644 --- a/codegen/main.rs +++ b/codegen/main.rs @@ -12,13 +12,18 @@ use std::{borrow::Cow, env::set_current_dir, fs, io, path::Path, process::Comman use structs::StructBindGenerator; use zip::ZipArchive; -const FLATC_BINARY: &str = if cfg!(windows) { "flatc.exe" } else { "flatc" }; -const OUT_FOLDER: &str = "./src/generated"; +const FLATC_DOWNLOAD_URL: &str = "https://github.com/google/flatbuffers/releases/download/v25.2.10/"; + const SCHEMA_FOLDER: &str = "./flatbuffers-schema"; const SCHEMA_FOLDER_BACKUP: &str = "../flatbuffers-schema"; +const RLBOT_FBS: &str = "schema/rlbot.fbs"; +const FLATC_BINARY: &str = if cfg!(windows) { + "binaries\\flatc.exe" +} else { + "binaries/flatc" +}; -const FLATC_DOWNLOAD_URL: &str = "https://github.com/google/flatbuffers/releases/download/v25.2.10/"; - +const OUT_FOLDER: &str = "./src/generated"; pub const PYTHON_OUT_FOLDER: &str = "./src/python"; pub enum PythonBindType { @@ -29,15 +34,14 @@ pub enum PythonBindType { impl PythonBindType { pub const BASE_TYPES: [&'static str; 6] = ["bool", "i32", "u32", "f32", "String", "u8"]; - pub const FROZEN_TYPES: [&'static str; 6] = [ + pub const FROZEN_TYPES: [&'static str; 26] = [ + "ControllableInfo", + "ControllableTeamInfo", + "PredictionSlice", + "BallPrediction", "GoalInfo", "BoostPad", "FieldInfo", - "ControllableInfo", - "ControllableTeamInfo", - "PlayerClass", - ]; - pub const NO_SET_TYPES: [&'static str; 16] = [ "Physics", "GamePacket", "PlayerInfo", @@ -52,13 +56,25 @@ impl PythonBindType { "MatchInfo", "TeamInfo", "Vector2", - "PredictionSlice", - "BallPrediction", + "CoreMessage", + "InterfaceMessage", + "CorePacket", + "InterfacePacket", + "PlayerInput", + ]; + pub const NO_SET_TYPES: [&'static str; 1] = ["PlayerClass"]; + pub const UNIONS: [&'static str; 6] = [ + "PlayerClass", + "CollisionShape", + "RelativeAnchor", + "RenderType", + "CoreMessage", + "InterfaceMessage", ]; - pub const UNIONS: [&'static str; 4] = ["PlayerClass", "CollisionShape", "RelativeAnchor", "RenderType"]; pub const OPTIONAL_UNIONS: [&'static str; 1] = ["RelativeAnchor"]; pub const DEFAULT_OVERRIDES: [(&'static str, &'static str, &'static str); 1] = [("Color", "a", "255")]; + pub const FIELD_ALIASES: [(&'static str, &'static str, &'static str); 1] = [("PlayerInfo", "player_id", "spawn_id")]; pub const FREELIST_TYPES: [(&'static str, usize); 0] = []; fn new(path: &Path) -> Option { @@ -176,7 +192,7 @@ fn mod_rs_generator(type_data: &[PythonBindType]) -> io::Result<()> { Ok(()) } -fn run_flatc() -> io::Result<()> { +fn run_flatc() { println!("cargo:rerun-if-changed=flatbuffers-schema/comms.fbs"); println!("cargo:rerun-if-changed=flatbuffers-schema/gamedata.fbs"); println!("cargo:rerun-if-changed=flatbuffers-schema/gamestatemanip.fbs"); @@ -184,7 +200,7 @@ fn run_flatc() -> io::Result<()> { println!("cargo:rerun-if-changed=flatbuffers-schema/rendering.fbs"); println!("cargo:rerun-if-changed=flatbuffers-schema/rlbot.fbs"); - set_current_dir(env!("CARGO_MANIFEST_DIR"))?; + set_current_dir(env!("CARGO_MANIFEST_DIR")).unwrap(); let mut schema_folder = Path::new(SCHEMA_FOLDER); if !schema_folder.exists() { @@ -197,24 +213,31 @@ fn run_flatc() -> io::Result<()> { let flatc_path = Path::new(&flatc_str); if !flatc_path.exists() { + fs::create_dir_all(flatc_path).unwrap(); + // if the flatc binary isn't found, download it let file_name = if cfg!(windows) { "Windows.flatc.binary.zip" } else { "Linux.flatc.binary.g++-13.zip" }; - let response = reqwest::blocking::get(format!("{FLATC_DOWNLOAD_URL}/{file_name}")).map_err(|e| { - eprintln!("Failed to download flatc binary: {e}"); - io::Error::other("Failed to download flatc binary") - })?; - let bytes = response.bytes().map_err(|e| { - eprintln!("Failed to read response stream when downloading flatc binary: {e}"); - io::Error::other("Failed to read response stream when downloading flatc binary") - })?; + let response = reqwest::blocking::get(format!("{FLATC_DOWNLOAD_URL}/{file_name}")) + .map_err(|e| { + eprintln!("Failed to download flatc binary: {e}"); + io::Error::other("Failed to download flatc binary") + }) + .unwrap(); + let bytes = response + .bytes() + .map_err(|e| { + eprintln!("Failed to read response stream when downloading flatc binary: {e}"); + io::Error::other("Failed to read response stream when downloading flatc binary") + }) + .unwrap(); // extract zip - let mut zip = ZipArchive::new(io::Cursor::new(bytes))?; - zip.extract(schema_folder)?; + let mut zip = ZipArchive::new(io::Cursor::new(bytes)).unwrap(); + zip.extract(schema_folder).unwrap(); assert!(flatc_path.exists(), "Failed to download flatc binary"); } @@ -222,26 +245,26 @@ fn run_flatc() -> io::Result<()> { let mut proc = Command::new(flatc_str); proc.args([ - "--rust", - "--gen-object-api", - "--gen-all", - "--filename-suffix", - "", - "--rust-module-root-file", - "-o", - OUT_FOLDER, - &format!("{schema_folder_str}/rlbot.fbs"), + "--rust".as_ref(), + "--gen-object-api".as_ref(), + "--gen-all".as_ref(), + "--filename-suffix".as_ref(), + "".as_ref(), + "--rust-module-root-file".as_ref(), + "-o".as_ref(), + OUT_FOLDER.as_ref(), + schema_folder.join(RLBOT_FBS).as_os_str(), ]) - .spawn()? - .wait()?; - - assert!(proc.status()?.success(), "flatc failed to run"); + .spawn() + .unwrap() + .wait() + .unwrap(); - Ok(()) + assert!(proc.status().unwrap().success(), "flatc failed to run"); } -fn main() -> io::Result<()> { - run_flatc()?; +fn main() { + run_flatc(); let out_folder = Path::new(OUT_FOLDER).join("rlbot").join("flat"); @@ -252,9 +275,11 @@ fn main() -> io::Result<()> { ); // read the current contents of the generated folder - let generated_files = fs::read_dir(out_folder)? + let generated_files = fs::read_dir(out_folder) + .unwrap() .map(|res| res.map(|e| e.path())) - .collect::, io::Error>>()?; + .collect::, io::Error>>() + .unwrap(); let mut type_data = Vec::new(); @@ -263,13 +288,11 @@ fn main() -> io::Result<()> { continue; }; - bind_generator.generate(&path)?; + bind_generator.generate(&path).unwrap(); type_data.push(bind_generator); } - mod_rs_generator(&type_data)?; - pyi::generator(&type_data)?; - class_inject::classes_to_lib_rs(&type_data)?; - - Ok(()) + mod_rs_generator(&type_data).unwrap(); + pyi::generator(&type_data).unwrap(); + class_inject::classes_to_lib_rs(&type_data).unwrap(); } diff --git a/codegen/pyi.rs b/codegen/pyi.rs index 429435c..d5cac7a 100644 --- a/codegen/pyi.rs +++ b/codegen/pyi.rs @@ -309,17 +309,6 @@ pub fn generator(type_data: &[PythonBindType]) -> io::Result<()> { write_str!(file, " Serializes this instance into a byte array"); write_str!(file, " \"\"\""); - if !bind.is_frozen { - write_str!(file, " def unpack_with(self, data: bytes) -> None:"); - write_str!(file, " \"\"\""); - write_str!(file, " Deserializes the data into this instance\n"); - write_str!( - file, - " :raises InvalidFlatbuffer: If the `data` is invalid for this type" - ); - write_str!(file, " \"\"\""); - } - write_str!(file, " @staticmethod"); write_fmt!(file, " def unpack(data: bytes) -> {type_name}:"); write_str!(file, " \"\"\""); diff --git a/codegen/structs.rs b/codegen/structs.rs index 81b10d3..b02f21e 100644 --- a/codegen/structs.rs +++ b/codegen/structs.rs @@ -56,6 +56,7 @@ pub struct StructBindGenerator { is_no_set: bool, pub default_override: Option<(&'static str, &'static str)>, freelist_size: usize, + aliases: Vec<(&'static str, &'static str)>, } macro_rules! write_str { @@ -81,27 +82,39 @@ impl StructBindGenerator { ) -> Option { let is_frozen = PythonBindType::FROZEN_TYPES.contains(&struct_name.as_str()); let is_no_set = PythonBindType::NO_SET_TYPES.contains(&struct_name.as_str()); + let aliases: Vec<_> = PythonBindType::FIELD_ALIASES + .iter() + .filter_map(|&(name, real, alias)| { + if name == struct_name.as_str() { + Some((real, alias)) + } else { + None + } + }) + .collect(); let has_complex_pack = contents.contains("pub fn pack<'b, A: flatbuffers::Allocator + 'b>("); let mut file_contents = vec![]; file_contents.push(Cow::Borrowed(if types.is_empty() { - "use crate::{flat_err_to_py, generated::rlbot::flat, FromGil};" - } else if is_frozen { - "use crate::{flat_err_to_py, generated::rlbot::flat, FromGil, IntoGil, PyDefault};" + "use crate::{FromGil, flat_err_to_py, generated::rlbot::flat};" } else { - "use crate::{flat_err_to_py, generated::rlbot::flat, FromGil, IntoGil, PyDefault, UnpackFrom};" + "use crate::{FromGil, IntoGil, PyDefault, flat_err_to_py, generated::rlbot::flat};" })); if has_complex_pack { - file_contents.push(Cow::Borrowed("use flatbuffers::{root, FlatBufferBuilder};")); + file_contents.push(Cow::Borrowed("use flatbuffers::{FlatBufferBuilder, root};")); file_contents.push(Cow::Borrowed("use get_size::GetSize;")); } else { file_contents.push(Cow::Borrowed("use flatbuffers::root;")); } file_contents.push(Cow::Borrowed("use pyo3::{prelude::*, types::*};")); + if !aliases.is_empty() { + file_contents.push(Cow::Borrowed("use std::sync::atomic::{AtomicBool, Ordering};")); + } + file_contents.push(Cow::Borrowed("")); let default_override = PythonBindType::DEFAULT_OVERRIDES.iter().find_map(|&(name, field, value)| { @@ -129,6 +142,7 @@ impl StructBindGenerator { is_no_set, default_override, freelist_size, + aliases, }) } @@ -443,6 +457,70 @@ impl StructBindGenerator { write_str!(self, " }"); write_str!(self, " }"); + for (real_name, alias) in &self.aliases { + let variable_info = self.types.iter().find(|info| info.name == *real_name).unwrap(); + + let variable_type = match &variable_info.rust_type { + RustType::Vec(InnerVecType::U8) => String::from("Py"), + RustType::Vec(InnerVecType::String) => String::from("Vec"), + RustType::Vec(InnerVecType::Base(inner_type)) => format!("Vec<{}>", inner_type), + RustType::Vec(InnerVecType::Custom(_)) => String::from("Py"), + RustType::Box(inner_type) => format!("Py"), + RustType::Option(InnerOptionType::BaseType, inner_type) => { + format!("Option>") + } + RustType::Option(InnerOptionType::String, _) => String::from("Option>"), + RustType::Union(inner_type, true) | RustType::Option(_, inner_type) => { + format!("Option>") + } + RustType::Base(inner_type) => match inner_type.as_str() { + "f32" => String::from("Py"), + _ => inner_type.clone(), + }, + RustType::String => String::from("Py"), + RustType::Union(inner_type, false) | RustType::Custom(inner_type) => { + format!("Py") + } + RustType::Other(inner_type) => format!("super::{inner_type}"), + }; + + write_str!(self, "\n #[getter]"); + write_fmt!(self, " pub fn get_{alias}(&self) -> {variable_type} {{"); + write_str!(self, " static PRINTED_WARNING: AtomicBool = AtomicBool::new(false);"); + write_str!( + self, + " if PRINTED_WARNING.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed).is_ok() {" + ); + write_fmt!( + self, + " println!(\"WARNING: '{alias}' getter accessed, which is deprecated in favor of '{real_name}'.\");" + ); + write_str!(self, " }"); + write_str!(self, ""); + write_fmt!(self, " self.{real_name}"); + write_str!(self, " }"); + + if self.is_frozen || self.is_no_set { + continue; + } + + write_str!(self, "\n #[setter]"); + write_fmt!(self, " pub fn set_{alias}(&mut self, new: {variable_type}) {{"); + write_str!(self, " static PRINTED_WARNING: AtomicBool = AtomicBool::new(false);"); + write_str!( + self, + " if PRINTED_WARNING.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed).is_ok() {" + ); + write_fmt!( + self, + " println!(\"WARNING: '{alias}' setter accessed, which is deprecated in favor of '{real_name}'.\");" + ); + write_str!(self, " }"); + write_str!(self, ""); + write_fmt!(self, " self.{real_name} = new;"); + write_str!(self, " }"); + } + if self.is_frozen || self.is_no_set { return; } @@ -660,157 +738,6 @@ impl StructBindGenerator { write_str!(self, " }"); } - fn generate_unpack_from(&mut self) { - write_fmt!( - self, - "impl UnpackFrom for {} {{", - self.struct_t_name, - self.struct_name - ); - write_str!(self, " #[allow(unused_variables)]"); - write_fmt!( - self, - " fn unpack_from(&mut self, py: Python, flat_t: flat::{}) {{", - self.struct_t_name - ); - - for variable_info in &self.types { - let variable_name = variable_info.name.as_str(); - - match &variable_info.rust_type { - RustType::Vec(InnerVecType::Custom(inner_type)) => { - write_fmt!( - self, - " crate::update_list::<_, super::{inner_type}>(py, self.{variable_name}.bind_borrowed(py), flat_t.{variable_name});", - ); - } - RustType::Vec(InnerVecType::U8) => { - write_fmt!( - self, - " self.{variable_name} = PyBytes::new(py, &flat_t.{variable_name}).unbind();" - ); - } - RustType::Option(InnerOptionType::Box, _) => { - write_fmt!(self, " match flat_t.{variable_name} {{"); - write_str!(self, " Some(x) => {"); - write_fmt!(self, " match &mut self.{variable_name} {{"); - write_str!( - self, - " Some(item) => item.bind_borrowed(py).borrow_mut().unpack_from(py, *x)," - ); - write_fmt!( - self, - " None => self.{variable_name} = Some(crate::into_py_from(py, *x))," - ); - write_str!(self, " }"); - write_str!(self, " }"); - write_fmt!(self, " None => self.{variable_name} = None,"); - write_str!(self, " }"); - } - RustType::Option(InnerOptionType::Custom, _) => { - write_fmt!(self, " match flat_t.{variable_name} {{"); - write_str!(self, " Some(x) => {"); - write_fmt!(self, " match &mut self.{variable_name} {{"); - write_str!( - self, - " Some(item) => item.bind_borrowed(py).borrow_mut().unpack_from(py, x)," - ); - write_fmt!( - self, - " None => self.{variable_name} = Some(crate::into_py_from(py, x))," - ); - write_str!(self, " }"); - write_str!(self, " }"); - write_fmt!(self, " None => self.{variable_name} = None,"); - write_str!(self, " }"); - } - RustType::Option(InnerOptionType::String, _) => { - write_fmt!( - self, - " self.{variable_name} = flat_t.{variable_name}.map(|s| PyString::new(py, &s).unbind());" - ); - } - RustType::Box(_) => { - write_fmt!( - self, - " self.{variable_name}.bind_borrowed(py).borrow_mut().unpack_from(py, *flat_t.{variable_name});" - ) - } - RustType::Custom(_) => { - write_fmt!( - self, - " self.{variable_name}.bind_borrowed(py).borrow_mut().unpack_from(py, flat_t.{variable_name});" - ) - } - RustType::Union(inner_type, true) => { - write_fmt!(self, " match flat_t.{variable_name} {{"); - write_fmt!(self, " flat::{inner_type}T::NONE => self.{variable_name} = None,"); - write_str!(self, " x => {"); - write_fmt!(self, " match &mut self.{variable_name} {{"); - write_str!( - self, - " Some(item) => item.bind_borrowed(py).borrow_mut().unpack_from(py, x)," - ); - write_fmt!( - self, - " None => self.{variable_name} = Some(crate::into_py_from(py, x))," - ); - write_str!(self, " }"); - write_str!(self, " }"); - write_str!(self, " }"); - } - RustType::Union(_, false) => { - let conv_str = if variable_info.is_frozen { - " = crate::into_py_from" - } else { - ".bind_borrowed(py).borrow_mut().unpack_from" - }; - - write_fmt!(self, " self.{variable_name}{conv_str}(py, flat_t.{variable_name});"); - } - RustType::String => { - write_fmt!( - self, - " self.{variable_name} = PyString::new(py, &flat_t.{variable_name}).unbind();" - ); - } - RustType::Base(inner_type) => match inner_type.as_str() { - "f32" => { - write_fmt!( - self, - " self.{variable_name} = crate::float_to_py(py, flat_t.{variable_name});" - ); - } - _ => { - write_fmt!(self, " self.{variable_name} = flat_t.{variable_name};"); - } - }, - RustType::Other(_) => { - write_fmt!(self, " self.{variable_name} = flat_t.{variable_name}.into();",); - } - _ => write_fmt!(self, " self.{variable_name} = flat_t.{variable_name};"), - } - } - - write_str!(self, " }"); - write_str!(self, "}"); - } - - fn generate_unpack_with(&mut self) { - write_fmt!( - self, - " fn unpack_with(&mut self, py: Python, data: &[u8]) -> PyResult<()> {{" - ); - write_fmt!(self, " match root::(data) {{", self.struct_name); - write_str!(self, " Ok(flat_t) => {"); - write_str!(self, " self.unpack_from(py, flat_t.unpack());"); - write_str!(self, " Ok(())"); - write_str!(self, " }"); - write_str!(self, " Err(e) => Err(flat_err_to_py(e)),"); - write_str!(self, " }"); - write_str!(self, " }"); - } - fn generate_unpack_method(&mut self) { write_str!(self, " #[staticmethod]"); write_str!(self, " fn unpack(py: Python, data: &[u8]) -> PyResult> {"); @@ -822,11 +749,6 @@ impl StructBindGenerator { write_str!(self, " Err(e) => Err(flat_err_to_py(e)),"); write_str!(self, " }"); write_str!(self, " }"); - - if !(self.is_frozen || self.types.is_empty()) { - write_str!(self, ""); - self.generate_unpack_with(); - } } } @@ -978,11 +900,6 @@ impl Generator for StructBindGenerator { write_str!(self, " }"); write_str!(self, "}"); write_str!(self, ""); - - if !self.is_frozen { - self.generate_unpack_from(); - write_str!(self, ""); - } } fn generate_from_flat_impls(&mut self) { diff --git a/codegen/unions.rs b/codegen/unions.rs index cb39b58..4191c75 100644 --- a/codegen/unions.rs +++ b/codegen/unions.rs @@ -29,8 +29,8 @@ impl UnionBindGenerator { let is_no_set = PythonBindType::NO_SET_TYPES.contains(&struct_name.as_str()); let file_contents = vec![ - Cow::Borrowed("use crate::{generated::rlbot::flat, FromGil, UnpackFrom};"), - Cow::Borrowed("use pyo3::{pyclass, pymethods, Bound, Py, PyAny, Python};"), + Cow::Borrowed("use crate::{FromGil, generated::rlbot::flat};"), + Cow::Borrowed("use pyo3::{Bound, Py, PyAny, Python, pyclass, pymethods};"), Cow::Borrowed(""), ]; @@ -120,63 +120,6 @@ impl UnionBindGenerator { write_str!(self, " }"); write_str!(self, " }"); } - - fn generate_unpack_from(&mut self) { - write_fmt!( - self, - "impl UnpackFrom for {} {{", - self.struct_t_name, - self.struct_name - ); - write_str!(self, " #[allow(unused_variables)]"); - write_fmt!( - self, - " fn unpack_from(&mut self, py: Python, flat_t: flat::{}) {{", - self.struct_t_name - ); - write_str!(self, " match flat_t {"); - - for variable_info in &self.types { - let variable_name = variable_info.name.as_str(); - - if variable_name == "NONE" { - write_fmt!(self, " flat::{}::NONE => unreachable!(),", self.struct_t_name); - continue; - } - - write_fmt!( - self, - " flat::{}::{variable_name}(flat_item) => {{", - self.struct_t_name - ); - write_fmt!( - self, - " if let {}Union::{variable_name}(item) = &self.item {{", - self.struct_name - ); - write_fmt!( - self, - " item.bind_borrowed(py).borrow_mut().unpack_from(py, *flat_item);" - ); - write_str!(self, " } else {"); - write_fmt!( - self, - " self.item = {}Union::{variable_name}(", - self.struct_name - ); - write_fmt!( - self, - " Py::new(py, super::{variable_name}::from_gil(py, *flat_item)).unwrap()" - ); - write_str!(self, " );"); - write_str!(self, " }"); - write_str!(self, " },"); - } - - write_str!(self, " }"); - write_str!(self, " }"); - write_str!(self, "}"); - } } impl Generator for UnionBindGenerator { @@ -262,10 +205,6 @@ impl Generator for UnionBindGenerator { write_str!(self, " }"); write_str!(self, "}"); write_str!(self, ""); - - if !self.is_frozen { - self.generate_unpack_from(); - } } fn generate_from_flat_impls(&mut self) { diff --git a/flatbuffers-schema b/flatbuffers-schema index 805c3cb..8922aa5 160000 --- a/flatbuffers-schema +++ b/flatbuffers-schema @@ -1 +1 @@ -Subproject commit 805c3cb5f0cd8aa13b940d98f9af59914aab0012 +Subproject commit 8922aa53c8c59812e153ec173f88525c4adc1de8 diff --git a/pybench.py b/pybench.py index ecbecb2..4c7646b 100644 --- a/pybench.py +++ b/pybench.py @@ -29,13 +29,7 @@ def test_gtp(): flat.GamePacket.unpack(packed) unpack_times.append(time_ns() - start) - start = time_ns() - gtp.unpack_with(packed) - unpack_with_times.append(time_ns() - start) - - print( - f"Total time: {(sum(pack_times) + sum(unpack_times) + sum(unpack_with_times)) / 1_000_000_000:.3f}s" - ) + print(f"Total time: {(sum(pack_times) + sum(unpack_times)) / 1_000_000_000:.3f}s") avg_time_ns = sum(pack_times) / len(pack_times) print(f"Average pack time per: {avg_time_ns / 1000:.1f}us") @@ -45,10 +39,6 @@ def test_gtp(): print(f"Average unpack time per: {avg_time_ns / 1000:.1f}us") print(f"Minimum unpack time per: {min(unpack_times) / 1000:.1f}us") - avg_time_ns = sum(unpack_with_times) / len(unpack_with_times) - print(f"Average unpack_with time per: {avg_time_ns / 1000:.1f}us") - print(f"Minimum unpack_with time per: {min(unpack_with_times) / 1000:.1f}us") - print() print("Testing normal GamePacket") @@ -74,13 +64,7 @@ def test_gtp(): flat.GamePacket.unpack(packed) unpack_times.append(time_ns() - start) - start = time_ns() - gtp.unpack_with(packed) - unpack_with_times.append(time_ns() - start) - - print( - f"Total time: {(sum(pack_times) + sum(unpack_times) + sum(unpack_with_times)) / 1_000_000_000:.3f}s" - ) + print(f"Total time: {(sum(pack_times) + sum(unpack_times)) / 1_000_000_000:.3f}s") avg_time_ns = sum(pack_times) / len(pack_times) print(f"Average pack time per: {avg_time_ns / 1000:.1f}us") @@ -90,17 +74,12 @@ def test_gtp(): print(f"Average unpack time per: {avg_time_ns / 1000:.1f}us") print(f"Minimum unpack time per: {min(unpack_times) / 1000:.1f}us") - avg_time_ns = sum(unpack_with_times) / len(unpack_with_times) - print(f"Average unpack_with time per: {avg_time_ns / 1000:.1f}us") - print(f"Minimum unpack_with time per: {min(unpack_with_times) / 1000:.1f}us") - def test_ballpred(): print("Testing 10s BallPrediction") pack_times = [] unpack_times = [] - unpack_with_times = [] ballPred = flat.BallPrediction([flat.PredictionSlice(1) for _ in range(120 * 10)]) @@ -115,13 +94,7 @@ def test_ballpred(): flat.BallPrediction.unpack(packed) unpack_times.append(time_ns() - start) - start = time_ns() - ballPred.unpack_with(packed) - unpack_with_times.append(time_ns() - start) - - print( - f"Total time: {(sum(pack_times) + sum(unpack_times) + sum(unpack_with_times)) / 1_000_000_000:.3f}s" - ) + print(f"Total time: {(sum(pack_times) + sum(unpack_times)) / 1_000_000_000:.3f}s") avg_time_ns = sum(pack_times) / len(pack_times) print(f"Average pack time per: {avg_time_ns / 1000:.1f}us") @@ -131,10 +104,6 @@ def test_ballpred(): print(f"Average unpack time per: {avg_time_ns / 1000:.1f}us") print(f"Minimum unpack time per: {min(unpack_times) / 1000:.1f}us") - avg_time_ns = sum(unpack_with_times) / len(unpack_with_times) - print(f"Average unpack_with time per: {avg_time_ns / 1000:.1f}us") - print(f"Minimum unpack_with time per: {min(unpack_with_times) / 1000:.1f}us") - print() print("Testing 6s BallPrediction") @@ -155,13 +124,7 @@ def test_ballpred(): flat.BallPrediction.unpack(packed) unpack_times.append(time_ns() - start) - start = time_ns() - ballPred.unpack_with(packed) - unpack_with_times.append(time_ns() - start) - - print( - f"Total time: {(sum(pack_times) + sum(unpack_times) + sum(unpack_with_times)) / 1_000_000_000:.3f}s" - ) + print(f"Total time: {(sum(pack_times) + sum(unpack_times)) / 1_000_000_000:.3f}s") avg_time_ns = sum(pack_times) / len(pack_times) print(f"Average pack time per: {avg_time_ns / 1000:.1f}us") @@ -171,10 +134,6 @@ def test_ballpred(): print(f"Average unpack time per: {avg_time_ns / 1000:.1f}us") print(f"Minimum unpack time per: {min(unpack_times) / 1000:.1f}us") - avg_time_ns = sum(unpack_with_times) / len(unpack_with_times) - print(f"Average unpack_with time per: {avg_time_ns / 1000:.1f}us") - print(f"Minimum unpack_with time per: {min(unpack_with_times) / 1000:.1f}us") - def find_slice_at_time(ball_prediction: flat.BallPrediction, game_time: float): """ diff --git a/pytest.py b/pytest.py index ad5f52c..6e549f1 100644 --- a/pytest.py +++ b/pytest.py @@ -165,29 +165,23 @@ def random_script_config(): data = ballPred.pack() print(f"BallPrediction size: {len(data)} bytes") + for i, slice in enumerate(ballPred.slices): + assert slice.game_seconds - (i / 120 + 1) < 1e-6 + # verify unpack_with method emptyBallPred = BallPrediction() data = emptyBallPred.pack() - - ballPred.unpack_with(data) - assert len(ballPred.slices) == 0 + assert len(emptyBallPred.slices) == 0 fullBallPred = BallPrediction([PredictionSlice(t / 120) for t in range(6 * 120)]) data = fullBallPred.pack() - - ballPred.unpack_with(data) - assert len(ballPred.slices) == 6 * 120 + assert len(fullBallPred.slices) == 6 * 120 halfBallPred = BallPrediction( [PredictionSlice(t / 120 + 1) for t in range(3 * 120)] ) data = halfBallPred.pack() - - ballPred.unpack_with(data) - assert len(ballPred.slices) == 3 * 120 - - for i, slice in enumerate(ballPred.slices): - assert slice.game_seconds - (i / 120 + 1) < 1e-6 + assert len(halfBallPred.slices) == 3 * 120 print() diff --git a/src/lib.rs b/src/lib.rs index 727e012..c2f1f5c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,7 +15,7 @@ pub mod generated; #[allow(clippy::enum_variant_names, clippy::useless_conversion, unused_imports)] mod python; -use pyo3::{PyClass, create_exception, exceptions::PyValueError, prelude::*, pyclass::boolean_struct::False, types::*}; +use pyo3::{PyClass, create_exception, exceptions::PyValueError, prelude::*, types::*}; use python::*; use std::{panic::Location, path::MAIN_SEPARATOR}; @@ -125,36 +125,6 @@ pub fn pydefault_string(py: Python) -> Py { PyString::intern(py, "").unbind() } -pub trait UnpackFrom { - fn unpack_from(&mut self, py: Python, flat_t: T); -} - -pub fn update_list(py: Python, items: Borrowed, flat_t: Vec) -where - T: IntoGil, - U: pyo3::PyClass + Into> + UnpackFrom, -{ - let scripts_len = flat_t.len(); - let mut script_iter = flat_t.into_iter(); - - for py_item in items.iter() { - match script_iter.next() { - Some(item) => py_item.downcast_into_exact::().unwrap().borrow_mut().unpack_from(py, item), - None => { - let items_len = items.len(); - for i in 0..items_len - scripts_len { - items.del_item(items_len - i - 1).unwrap(); - } - return; - } - } - } - - for x in script_iter { - items.append(crate::into_py_from::<_, U>(py, x)).unwrap(); - } -} - #[derive(FromPyObject)] pub enum PartFloats { Float(f64), @@ -236,6 +206,8 @@ pynamedmodule! { ControllableInfo, ControllableTeamInfo, ControllerState, + CoreMessage, + CorePacket, CustomBot, CylinderShape, DemolishMutator, @@ -245,6 +217,7 @@ pynamedmodule! { DesiredGameState, DesiredMatchInfo, DesiredPhysics, + DisconnectSignal, DodgeTimerMutator, ExistingMatchBehavior, FieldInfo, @@ -256,7 +229,10 @@ pynamedmodule! { GoalInfo, GravityMutator, Human, + InitComplete, InputRestrictionMutator, + InterfaceMessage, + InterfacePacket, JumpMutator, Launcher, Line3D,