From d52a1c4d8e8e32ce0ed56f80d8c25e10283a7c87 Mon Sep 17 00:00:00 2001 From: Tao Tien <29749622+taotien@users.noreply.github.com> Date: Fri, 6 Feb 2026 22:07:10 -0800 Subject: [PATCH] some cleanup --- Cargo.lock | 221 ++--- Cargo.toml | 18 +- flake.lock | 12 +- flake.nix | 10 +- jong/Cargo.toml | 27 +- .../create_player_reducer.rs | 105 -- jong/src/jongline_bindings/drawn_table.rs | 95 -- jong/src/jongline_bindings/drawn_type.rs | 13 - jong/src/jongline_bindings/hand_table.rs | 95 -- jong/src/jongline_bindings/hand_type.rs | 13 - .../identity_connected_reducer.rs | 101 -- .../identity_disconnected_reducer.rs | 103 -- jong/src/jongline_bindings/mod.rs | 916 ------------------ jong/src/jongline_bindings/player_table.rs | 95 -- jong/src/jongline_bindings/player_type.rs | 17 - jong/src/jongline_bindings/table_table.rs | 97 -- jong/src/jongline_bindings/table_type.rs | 19 - jong/src/jongline_bindings/wall_table.rs | 95 -- jong/src/jongline_bindings/wall_type.rs | 13 - jong/src/lib.rs | 6 +- jong/src/main.rs | 14 +- jong/src/tui/input/keyboard.rs | 3 +- jong/src/tui/input/mouse.rs | 23 +- jongline/Cargo.toml | 14 - jongline/src/lib.rs | 67 -- 25 files changed, 138 insertions(+), 2054 deletions(-) delete mode 100644 jong/src/jongline_bindings/create_player_reducer.rs delete mode 100644 jong/src/jongline_bindings/drawn_table.rs delete mode 100644 jong/src/jongline_bindings/drawn_type.rs delete mode 100644 jong/src/jongline_bindings/hand_table.rs delete mode 100644 jong/src/jongline_bindings/hand_type.rs delete mode 100644 jong/src/jongline_bindings/identity_connected_reducer.rs delete mode 100644 jong/src/jongline_bindings/identity_disconnected_reducer.rs delete mode 100644 jong/src/jongline_bindings/mod.rs delete mode 100644 jong/src/jongline_bindings/player_table.rs delete mode 100644 jong/src/jongline_bindings/player_type.rs delete mode 100644 jong/src/jongline_bindings/table_table.rs delete mode 100644 jong/src/jongline_bindings/table_type.rs delete mode 100644 jong/src/jongline_bindings/wall_table.rs delete mode 100644 jong/src/jongline_bindings/wall_type.rs delete mode 100644 jongline/Cargo.toml delete mode 100644 jongline/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 8141aca..b9331ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,7 +97,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.3.4", + "getrandom", "once_cell", "version_check", "zerocopy", @@ -249,9 +249,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea" [[package]] name = "anymap" @@ -1173,7 +1173,7 @@ dependencies = [ "critical-section", "foldhash 0.2.0", "futures-channel", - "getrandom 0.3.4", + "getrandom", "hashbrown 0.16.1", "js-sys", "portable-atomic", @@ -1229,7 +1229,6 @@ dependencies = [ "bitflags 2.10.0", "color-eyre", "ratatui", - "smol_str", "tracing", ] @@ -1839,9 +1838,9 @@ checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "bytemuck" -version = "1.24.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" dependencies = [ "bytemuck_derive", ] @@ -1871,9 +1870,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "bytestring" @@ -1922,9 +1921,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.53" +version = "1.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932" +checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" dependencies = [ "find-msvc-tools", "jobserver", @@ -1984,9 +1983,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.54" +version = "4.5.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" +checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a" dependencies = [ "clap_builder", "clap_derive", @@ -1994,9 +1993,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.54" +version = "4.5.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" +checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238" dependencies = [ "anstream", "anstyle", @@ -2006,9 +2005,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.49" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -2829,9 +2828,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "finl_unicode" @@ -2853,9 +2852,9 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "flate2" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "miniz_oxide", @@ -3084,17 +3083,6 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "getrandom" version = "0.3.4" @@ -3437,9 +3425,9 @@ checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3733,7 +3721,7 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom 0.3.4", + "getrandom", "libc", ] @@ -3745,7 +3733,6 @@ dependencies = [ "bevy_ratatui", "bevy_spacetimedb", "clap", - "jongline", "log", "rand 0.9.2", "ratatui", @@ -3755,14 +3742,6 @@ dependencies = [ "tui-logger", ] -[[package]] -name = "jongline" -version = "0.1.0" -dependencies = [ - "log", - "spacetimedb", -] - [[package]] name = "js-sys" version = "0.3.85" @@ -3860,9 +3839,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" @@ -3981,9 +3960,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "memmap2" @@ -4243,9 +4222,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-derive" @@ -4733,9 +4712,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" -version = "2.8.5" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9eb05c21a464ea704b53158d358a31e6425db2f63a1a7312268b05fe2b75f7" +checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662" dependencies = [ "memchr", "ucd-trie", @@ -4743,9 +4722,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.8.5" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f9dbced329c441fa79d80472764b1a2c7e57123553b8519b36663a2fb234ed" +checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77" dependencies = [ "pest", "pest_generator", @@ -4753,9 +4732,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.5" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bb96d5051a78f44f43c8f712d8e810adb0ebf923fc9ed2655a7f66f63ba8ee5" +checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f" dependencies = [ "pest", "pest_meta", @@ -4766,9 +4745,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.8.5" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602113b5b5e8621770cfd490cfd90b9f84ab29bd2b0e49ad83eb6d186cef2365" +checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220" dependencies = [ "pest", "sha2", @@ -4917,15 +4896,15 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" dependencies = [ "portable-atomic", ] @@ -5059,8 +5038,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "libc", - "rand_chacha 0.3.1", "rand_core 0.6.4", ] @@ -5070,20 +5047,10 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_chacha 0.9.0", + "rand_chacha", "rand_core 0.9.5", ] -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - [[package]] name = "rand_chacha" version = "0.9.0" @@ -5099,9 +5066,6 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] [[package]] name = "rand_core" @@ -5109,7 +5073,7 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom 0.3.4", + "getrandom", ] [[package]] @@ -5310,9 +5274,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -5322,9 +5286,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -5333,9 +5297,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" [[package]] name = "renderdoc-sys" @@ -5495,9 +5459,9 @@ dependencies = [ [[package]] name = "schemars" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" dependencies = [ "dyn-clone", "ref-cast", @@ -5632,7 +5596,7 @@ dependencies = [ "indexmap 1.9.3", "indexmap 2.13.0", "schemars 0.9.0", - "schemars 1.2.0", + "schemars 1.2.1", "serde_core", "serde_json", "serde_with_macros", @@ -5737,9 +5701,9 @@ checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "siphasher" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" [[package]] name = "skrifa" @@ -5753,9 +5717,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "slotmap" @@ -5808,36 +5772,14 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" dependencies = [ "libc", "windows-sys 0.60.2", ] -[[package]] -name = "spacetimedb" -version = "1.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83af98280374b59796296f512f7855fd19e19240a358bb7706a54f1c4e4e7dff" -dependencies = [ - "anyhow", - "bytemuck", - "bytes", - "derive_more 0.99.20", - "getrandom 0.2.17", - "http", - "log", - "rand 0.8.5", - "scoped-tls", - "serde_json", - "spacetimedb-bindings-macro", - "spacetimedb-bindings-sys", - "spacetimedb-lib", - "spacetimedb-primitives", -] - [[package]] name = "spacetimedb-bindings-macro" version = "1.11.3" @@ -5852,15 +5794,6 @@ dependencies = [ "syn 2.0.114", ] -[[package]] -name = "spacetimedb-bindings-sys" -version = "1.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0d30e1655731b1564b7094a6213ef6c354ea920e3c04424e55ad377a1bc3e2" -dependencies = [ - "spacetimedb-primitives", -] - [[package]] name = "spacetimedb-client-api-messages" version = "1.11.3" @@ -6191,7 +6124,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom", "once_cell", "rustix 1.1.3", "windows-sys 0.61.2", @@ -6320,9 +6253,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.45" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", @@ -6337,15 +6270,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.25" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", @@ -6722,9 +6655,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.2.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unicode-xid" @@ -6764,12 +6697,12 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" +checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" dependencies = [ "atomic", - "getrandom 0.3.4", + "getrandom", "js-sys", "serde_core", "wasm-bindgen", @@ -7047,7 +6980,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "692daff6d93d94e29e4114544ef6d5c942a7ed998b37abdc19b17136ea428eb7" dependencies = [ - "getrandom 0.3.4", + "getrandom", "mac_address", "sha2", "thiserror 1.0.69", @@ -7978,18 +7911,18 @@ checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", @@ -8052,6 +7985,6 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.16" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65" +checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445" diff --git a/Cargo.toml b/Cargo.toml index aa55a94..66302f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,25 @@ [workspace] resolver = "3" -members = ["jong", "jongline"] +members = ["jong"] + +[workspace.dependencies] +bevy = "0.17.3" +bevy_ratatui = "0.10.0" +bevy_spacetimedb = "0.7" +clap = "4.5.54" +log = "0.4.29" +rand = "0.9.2" +ratatui = "0.30.0" +strum = "0.27.2" +tracing = "0.1.44" +tracing-subscriber = "0.3.22" +tui-logger = "0.18.0" [profile.dev] opt-level = 1 [profile.dev.package."*"] opt-level = 3 + +[patch.crates-io] +bevy_ratatui = {path = "/home/tao/clones/bevy_ratatui"} diff --git a/flake.lock b/flake.lock index e4af06f..13b0421 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1768564909, - "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=", + "lastModified": 1770197578, + "narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f", + "rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2", "type": "github" }, "original": { @@ -62,11 +62,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1768617670, - "narHash": "sha256-Z3+6dxoWZn+QFwjxAt5ZGXkiuCvCLgQP6pTS5eSWXqk=", + "lastModified": 1770433312, + "narHash": "sha256-IaiqGwmLBrR0z67t/oaS6GIFxv9V8mDY7dBTuYVTbKY=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "56d0fbdd732f3686e8414b857cf885038fc17d57", + "rev": "9922ff9f99a6436756cbe6f5d11f9c3630e58cf0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 826c958..3a332de 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ }; in { devShells.default = with pkgs; - mkShell { + mkShell rec { buildInputs = [ # Rust dependencies @@ -53,13 +53,7 @@ binaryen ]; RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; - LD_LIBRARY_PATH = lib.makeLibraryPath [ - vulkan-loader - xorg.libX11 - xorg.libXi - xorg.libXcursor - libxkbcommon - ]; + LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs; RUST_LOG = "jong=trace"; }; } diff --git a/jong/Cargo.toml b/jong/Cargo.toml index 8ab386e..74353e2 100644 --- a/jong/Cargo.toml +++ b/jong/Cargo.toml @@ -10,19 +10,16 @@ readme = false [lib] [dependencies] -bevy = { version = "0.17.3", features = ["dynamic_linking"] } +bevy = { workspace = true, features = ["dynamic_linking"] } +bevy_ratatui = { workspace = true } # bevy_ratatui = { git = "https://github.com/kenianbei/bevy_ratatui.git", rev = "e4b022308e08ab360ef89eca8e9f8b1c969e9a56" } -bevy_ratatui = { path = "/home/tao/clones/bevy_ratatui" } -bevy_spacetimedb = "0.7" -clap = { version = "4.5.54", features = ["derive"] } -jongline = { version = "0.1.0", path = "../jongline" } -log = { version = "0.4.29", features = [ - "release_max_level_error", - "max_level_trace", -] } -rand = "0.9.2" -ratatui = "0.30.0" -strum = { version = "0.27.2", features = ["derive"] } -tracing = "0.1.44" -tracing-subscriber = "0.3.22" -tui-logger = { version = "0.18.0", features = ["tracing-support", "crossterm"] } +# bevy_ratatui = { path = "/home/tao/clones/bevy_ratatui" } +bevy_spacetimedb = { workspace = true } +clap = { workspace = true, features = ["derive"] } +log = { workspace = true, features = ["release_max_level_error", "max_level_trace"] } +rand = { workspace = true } +ratatui = { workspace = true } +strum = { workspace = true, features = ["derive"] } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } +tui-logger = { workspace = true, features = ["tracing-support", "crossterm"] } diff --git a/jong/src/jongline_bindings/create_player_reducer.rs b/jong/src/jongline_bindings/create_player_reducer.rs deleted file mode 100644 index 6271888..0000000 --- a/jong/src/jongline_bindings/create_player_reducer.rs +++ /dev/null @@ -1,105 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub(super) struct CreatePlayerArgs { - pub username: String, -} - -impl From for super::Reducer { - fn from(args: CreatePlayerArgs) -> Self { - Self::CreatePlayer { - username: args.username, - } - } -} - -impl __sdk::InModule for CreatePlayerArgs { - type Module = super::RemoteModule; -} - -pub struct CreatePlayerCallbackId(__sdk::CallbackId); - -#[allow(non_camel_case_types)] -/// Extension trait for access to the reducer `create_player`. -/// -/// Implemented for [`super::RemoteReducers`]. -pub trait create_player { - /// Request that the remote module invoke the reducer `create_player` to run as soon as possible. - /// - /// This method returns immediately, and errors only if we are unable to send the request. - /// The reducer will run asynchronously in the future, - /// and its status can be observed by listening for [`Self::on_create_player`] callbacks. - fn create_player(&self, username: String) -> __sdk::Result<()>; - /// Register a callback to run whenever we are notified of an invocation of the reducer `create_player`. - /// - /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] - /// to determine the reducer's status. - /// - /// The returned [`CreatePlayerCallbackId`] can be passed to [`Self::remove_on_create_player`] - /// to cancel the callback. - fn on_create_player( - &self, - callback: impl FnMut(&super::ReducerEventContext, &String) + Send + 'static, - ) -> CreatePlayerCallbackId; - /// Cancel a callback previously registered by [`Self::on_create_player`], - /// causing it not to run in the future. - fn remove_on_create_player(&self, callback: CreatePlayerCallbackId); -} - -impl create_player for super::RemoteReducers { - fn create_player(&self, username: String) -> __sdk::Result<()> { - self.imp - .call_reducer("create_player", CreatePlayerArgs { username }) - } - fn on_create_player( - &self, - mut callback: impl FnMut(&super::ReducerEventContext, &String) + Send + 'static, - ) -> CreatePlayerCallbackId { - CreatePlayerCallbackId(self.imp.on_reducer( - "create_player", - Box::new(move |ctx: &super::ReducerEventContext| { - #[allow(irrefutable_let_patterns)] - let super::ReducerEventContext { - event: - __sdk::ReducerEvent { - reducer: super::Reducer::CreatePlayer { username }, - .. - }, - .. - } = ctx - else { - unreachable!() - }; - callback(ctx, username) - }), - )) - } - fn remove_on_create_player(&self, callback: CreatePlayerCallbackId) { - self.imp.remove_on_reducer("create_player", callback.0) - } -} - -#[allow(non_camel_case_types)] -#[doc(hidden)] -/// Extension trait for setting the call-flags for the reducer `create_player`. -/// -/// Implemented for [`super::SetReducerFlags`]. -/// -/// This type is currently unstable and may be removed without a major version bump. -pub trait set_flags_for_create_player { - /// Set the call-reducer flags for the reducer `create_player` to `flags`. - /// - /// This type is currently unstable and may be removed without a major version bump. - fn create_player(&self, flags: __ws::CallReducerFlags); -} - -impl set_flags_for_create_player for super::SetReducerFlags { - fn create_player(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("create_player", flags); - } -} diff --git a/jong/src/jongline_bindings/drawn_table.rs b/jong/src/jongline_bindings/drawn_table.rs deleted file mode 100644 index 2df1f4b..0000000 --- a/jong/src/jongline_bindings/drawn_table.rs +++ /dev/null @@ -1,95 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::drawn_type::Drawn; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `drawn`. -/// -/// Obtain a handle from the [`DrawnTableAccess::drawn`] method on [`super::RemoteTables`], -/// like `ctx.db.drawn()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.drawn().on_insert(...)`. -pub struct DrawnTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `drawn`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait DrawnTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`DrawnTableHandle`], which mediates access to the table `drawn`. - fn drawn(&self) -> DrawnTableHandle<'_>; -} - -impl DrawnTableAccess for super::RemoteTables { - fn drawn(&self) -> DrawnTableHandle<'_> { - DrawnTableHandle { - imp: self.imp.get_table::("drawn"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct DrawnInsertCallbackId(__sdk::CallbackId); -pub struct DrawnDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for DrawnTableHandle<'ctx> { - type Row = Drawn; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = DrawnInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> DrawnInsertCallbackId { - DrawnInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: DrawnInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = DrawnDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> DrawnDeleteCallbackId { - DrawnDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: DrawnDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("drawn"); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} diff --git a/jong/src/jongline_bindings/drawn_type.rs b/jong/src/jongline_bindings/drawn_type.rs deleted file mode 100644 index c443a03..0000000 --- a/jong/src/jongline_bindings/drawn_type.rs +++ /dev/null @@ -1,13 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub struct Drawn {} - -impl __sdk::InModule for Drawn { - type Module = super::RemoteModule; -} diff --git a/jong/src/jongline_bindings/hand_table.rs b/jong/src/jongline_bindings/hand_table.rs deleted file mode 100644 index 9e15c00..0000000 --- a/jong/src/jongline_bindings/hand_table.rs +++ /dev/null @@ -1,95 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::hand_type::Hand; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `hand`. -/// -/// Obtain a handle from the [`HandTableAccess::hand`] method on [`super::RemoteTables`], -/// like `ctx.db.hand()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.hand().on_insert(...)`. -pub struct HandTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `hand`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait HandTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`HandTableHandle`], which mediates access to the table `hand`. - fn hand(&self) -> HandTableHandle<'_>; -} - -impl HandTableAccess for super::RemoteTables { - fn hand(&self) -> HandTableHandle<'_> { - HandTableHandle { - imp: self.imp.get_table::("hand"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct HandInsertCallbackId(__sdk::CallbackId); -pub struct HandDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for HandTableHandle<'ctx> { - type Row = Hand; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = HandInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> HandInsertCallbackId { - HandInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: HandInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = HandDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> HandDeleteCallbackId { - HandDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: HandDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("hand"); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} diff --git a/jong/src/jongline_bindings/hand_type.rs b/jong/src/jongline_bindings/hand_type.rs deleted file mode 100644 index f2bbfd2..0000000 --- a/jong/src/jongline_bindings/hand_type.rs +++ /dev/null @@ -1,13 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub struct Hand {} - -impl __sdk::InModule for Hand { - type Module = super::RemoteModule; -} diff --git a/jong/src/jongline_bindings/identity_connected_reducer.rs b/jong/src/jongline_bindings/identity_connected_reducer.rs deleted file mode 100644 index 2eaaab0..0000000 --- a/jong/src/jongline_bindings/identity_connected_reducer.rs +++ /dev/null @@ -1,101 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub(super) struct IdentityConnectedArgs {} - -impl From for super::Reducer { - fn from(args: IdentityConnectedArgs) -> Self { - Self::IdentityConnected - } -} - -impl __sdk::InModule for IdentityConnectedArgs { - type Module = super::RemoteModule; -} - -pub struct IdentityConnectedCallbackId(__sdk::CallbackId); - -#[allow(non_camel_case_types)] -/// Extension trait for access to the reducer `identity_connected`. -/// -/// Implemented for [`super::RemoteReducers`]. -pub trait identity_connected { - /// Request that the remote module invoke the reducer `identity_connected` to run as soon as possible. - /// - /// This method returns immediately, and errors only if we are unable to send the request. - /// The reducer will run asynchronously in the future, - /// and its status can be observed by listening for [`Self::on_identity_connected`] callbacks. - fn identity_connected(&self) -> __sdk::Result<()>; - /// Register a callback to run whenever we are notified of an invocation of the reducer `identity_connected`. - /// - /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] - /// to determine the reducer's status. - /// - /// The returned [`IdentityConnectedCallbackId`] can be passed to [`Self::remove_on_identity_connected`] - /// to cancel the callback. - fn on_identity_connected( - &self, - callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, - ) -> IdentityConnectedCallbackId; - /// Cancel a callback previously registered by [`Self::on_identity_connected`], - /// causing it not to run in the future. - fn remove_on_identity_connected(&self, callback: IdentityConnectedCallbackId); -} - -impl identity_connected for super::RemoteReducers { - fn identity_connected(&self) -> __sdk::Result<()> { - self.imp - .call_reducer("identity_connected", IdentityConnectedArgs {}) - } - fn on_identity_connected( - &self, - mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, - ) -> IdentityConnectedCallbackId { - IdentityConnectedCallbackId(self.imp.on_reducer( - "identity_connected", - Box::new(move |ctx: &super::ReducerEventContext| { - #[allow(irrefutable_let_patterns)] - let super::ReducerEventContext { - event: - __sdk::ReducerEvent { - reducer: super::Reducer::IdentityConnected {}, - .. - }, - .. - } = ctx - else { - unreachable!() - }; - callback(ctx) - }), - )) - } - fn remove_on_identity_connected(&self, callback: IdentityConnectedCallbackId) { - self.imp.remove_on_reducer("identity_connected", callback.0) - } -} - -#[allow(non_camel_case_types)] -#[doc(hidden)] -/// Extension trait for setting the call-flags for the reducer `identity_connected`. -/// -/// Implemented for [`super::SetReducerFlags`]. -/// -/// This type is currently unstable and may be removed without a major version bump. -pub trait set_flags_for_identity_connected { - /// Set the call-reducer flags for the reducer `identity_connected` to `flags`. - /// - /// This type is currently unstable and may be removed without a major version bump. - fn identity_connected(&self, flags: __ws::CallReducerFlags); -} - -impl set_flags_for_identity_connected for super::SetReducerFlags { - fn identity_connected(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("identity_connected", flags); - } -} diff --git a/jong/src/jongline_bindings/identity_disconnected_reducer.rs b/jong/src/jongline_bindings/identity_disconnected_reducer.rs deleted file mode 100644 index c2892ed..0000000 --- a/jong/src/jongline_bindings/identity_disconnected_reducer.rs +++ /dev/null @@ -1,103 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub(super) struct IdentityDisconnectedArgs {} - -impl From for super::Reducer { - fn from(args: IdentityDisconnectedArgs) -> Self { - Self::IdentityDisconnected - } -} - -impl __sdk::InModule for IdentityDisconnectedArgs { - type Module = super::RemoteModule; -} - -pub struct IdentityDisconnectedCallbackId(__sdk::CallbackId); - -#[allow(non_camel_case_types)] -/// Extension trait for access to the reducer `identity_disconnected`. -/// -/// Implemented for [`super::RemoteReducers`]. -pub trait identity_disconnected { - /// Request that the remote module invoke the reducer `identity_disconnected` to run as soon as possible. - /// - /// This method returns immediately, and errors only if we are unable to send the request. - /// The reducer will run asynchronously in the future, - /// and its status can be observed by listening for [`Self::on_identity_disconnected`] callbacks. - fn identity_disconnected(&self) -> __sdk::Result<()>; - /// Register a callback to run whenever we are notified of an invocation of the reducer `identity_disconnected`. - /// - /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] - /// to determine the reducer's status. - /// - /// The returned [`IdentityDisconnectedCallbackId`] can be passed to [`Self::remove_on_identity_disconnected`] - /// to cancel the callback. - fn on_identity_disconnected( - &self, - callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, - ) -> IdentityDisconnectedCallbackId; - /// Cancel a callback previously registered by [`Self::on_identity_disconnected`], - /// causing it not to run in the future. - fn remove_on_identity_disconnected(&self, callback: IdentityDisconnectedCallbackId); -} - -impl identity_disconnected for super::RemoteReducers { - fn identity_disconnected(&self) -> __sdk::Result<()> { - self.imp - .call_reducer("identity_disconnected", IdentityDisconnectedArgs {}) - } - fn on_identity_disconnected( - &self, - mut callback: impl FnMut(&super::ReducerEventContext) + Send + 'static, - ) -> IdentityDisconnectedCallbackId { - IdentityDisconnectedCallbackId(self.imp.on_reducer( - "identity_disconnected", - Box::new(move |ctx: &super::ReducerEventContext| { - #[allow(irrefutable_let_patterns)] - let super::ReducerEventContext { - event: - __sdk::ReducerEvent { - reducer: super::Reducer::IdentityDisconnected {}, - .. - }, - .. - } = ctx - else { - unreachable!() - }; - callback(ctx) - }), - )) - } - fn remove_on_identity_disconnected(&self, callback: IdentityDisconnectedCallbackId) { - self.imp - .remove_on_reducer("identity_disconnected", callback.0) - } -} - -#[allow(non_camel_case_types)] -#[doc(hidden)] -/// Extension trait for setting the call-flags for the reducer `identity_disconnected`. -/// -/// Implemented for [`super::SetReducerFlags`]. -/// -/// This type is currently unstable and may be removed without a major version bump. -pub trait set_flags_for_identity_disconnected { - /// Set the call-reducer flags for the reducer `identity_disconnected` to `flags`. - /// - /// This type is currently unstable and may be removed without a major version bump. - fn identity_disconnected(&self, flags: __ws::CallReducerFlags); -} - -impl set_flags_for_identity_disconnected for super::SetReducerFlags { - fn identity_disconnected(&self, flags: __ws::CallReducerFlags) { - self.imp - .set_call_reducer_flags("identity_disconnected", flags); - } -} diff --git a/jong/src/jongline_bindings/mod.rs b/jong/src/jongline_bindings/mod.rs deleted file mode 100644 index 00aa7f7..0000000 --- a/jong/src/jongline_bindings/mod.rs +++ /dev/null @@ -1,916 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -// This was generated using spacetimedb cli version 1.11.3 (commit 02449737ca3b29e7e39679fccbef541a50f32094). - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -pub mod create_player_reducer; -pub mod drawn_table; -pub mod drawn_type; -pub mod hand_table; -pub mod hand_type; -pub mod identity_connected_reducer; -pub mod identity_disconnected_reducer; -pub mod player_table; -pub mod player_type; -pub mod table_table; -pub mod table_type; -pub mod wall_table; -pub mod wall_type; - -pub use create_player_reducer::{ - create_player, set_flags_for_create_player, CreatePlayerCallbackId, -}; -pub use drawn_table::*; -pub use drawn_type::Drawn; -pub use hand_table::*; -pub use hand_type::Hand; -pub use identity_connected_reducer::{ - identity_connected, set_flags_for_identity_connected, IdentityConnectedCallbackId, -}; -pub use identity_disconnected_reducer::{ - identity_disconnected, set_flags_for_identity_disconnected, IdentityDisconnectedCallbackId, -}; -pub use player_table::*; -pub use player_type::Player; -pub use table_table::*; -pub use table_type::Table; -pub use wall_table::*; -pub use wall_type::Wall; - -#[derive(Clone, PartialEq, Debug)] - -/// One of the reducers defined by this module. -/// -/// Contained within a [`__sdk::ReducerEvent`] in [`EventContext`]s for reducer events -/// to indicate which reducer caused the event. - -pub enum Reducer { - CreatePlayer { username: String }, - IdentityConnected, - IdentityDisconnected, -} - -impl __sdk::InModule for Reducer { - type Module = RemoteModule; -} - -impl __sdk::Reducer for Reducer { - fn reducer_name(&self) -> &'static str { - match self { - Reducer::CreatePlayer { .. } => "create_player", - Reducer::IdentityConnected => "identity_connected", - Reducer::IdentityDisconnected => "identity_disconnected", - _ => unreachable!(), - } - } -} -impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { - type Error = __sdk::Error; - fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __sdk::Result { - match &value.reducer_name[..] { - "create_player" => Ok(__sdk::parse_reducer_args::< - create_player_reducer::CreatePlayerArgs, - >("create_player", &value.args)? - .into()), - "identity_connected" => Ok(__sdk::parse_reducer_args::< - identity_connected_reducer::IdentityConnectedArgs, - >("identity_connected", &value.args)? - .into()), - "identity_disconnected" => Ok(__sdk::parse_reducer_args::< - identity_disconnected_reducer::IdentityDisconnectedArgs, - >("identity_disconnected", &value.args)? - .into()), - unknown => { - Err( - __sdk::InternalError::unknown_name("reducer", unknown, "ReducerCallInfo") - .into(), - ) - } - } - } -} - -#[derive(Default)] -#[allow(non_snake_case)] -#[doc(hidden)] -pub struct DbUpdate { - drawn: __sdk::TableUpdate, - hand: __sdk::TableUpdate, - player: __sdk::TableUpdate, - table: __sdk::TableUpdate, - wall: __sdk::TableUpdate, -} - -impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate { - type Error = __sdk::Error; - fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result { - let mut db_update = DbUpdate::default(); - for table_update in raw.tables { - match &table_update.table_name[..] { - "drawn" => db_update - .drawn - .append(drawn_table::parse_table_update(table_update)?), - "hand" => db_update - .hand - .append(hand_table::parse_table_update(table_update)?), - "player" => db_update - .player - .append(player_table::parse_table_update(table_update)?), - "table" => db_update - .table - .append(table_table::parse_table_update(table_update)?), - "wall" => db_update - .wall - .append(wall_table::parse_table_update(table_update)?), - - unknown => { - return Err(__sdk::InternalError::unknown_name( - "table", - unknown, - "DatabaseUpdate", - ) - .into()); - } - } - } - Ok(db_update) - } -} - -impl __sdk::InModule for DbUpdate { - type Module = RemoteModule; -} - -impl __sdk::DbUpdate for DbUpdate { - fn apply_to_client_cache( - &self, - cache: &mut __sdk::ClientCache, - ) -> AppliedDiff<'_> { - let mut diff = AppliedDiff::default(); - - diff.drawn = cache.apply_diff_to_table::("drawn", &self.drawn); - diff.hand = cache.apply_diff_to_table::("hand", &self.hand); - diff.player = cache.apply_diff_to_table::("player", &self.player); - diff.table = cache.apply_diff_to_table::
("table", &self.table); - diff.wall = cache.apply_diff_to_table::("wall", &self.wall); - - diff - } -} - -#[derive(Default)] -#[allow(non_snake_case)] -#[doc(hidden)] -pub struct AppliedDiff<'r> { - drawn: __sdk::TableAppliedDiff<'r, Drawn>, - hand: __sdk::TableAppliedDiff<'r, Hand>, - player: __sdk::TableAppliedDiff<'r, Player>, - table: __sdk::TableAppliedDiff<'r, Table>, - wall: __sdk::TableAppliedDiff<'r, Wall>, - __unused: std::marker::PhantomData<&'r ()>, -} - -impl __sdk::InModule for AppliedDiff<'_> { - type Module = RemoteModule; -} - -impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> { - fn invoke_row_callbacks( - &self, - event: &EventContext, - callbacks: &mut __sdk::DbCallbacks, - ) { - callbacks.invoke_table_row_callbacks::("drawn", &self.drawn, event); - callbacks.invoke_table_row_callbacks::("hand", &self.hand, event); - callbacks.invoke_table_row_callbacks::("player", &self.player, event); - callbacks.invoke_table_row_callbacks::
("table", &self.table, event); - callbacks.invoke_table_row_callbacks::("wall", &self.wall, event); - } -} - -#[doc(hidden)] -pub struct RemoteModule; - -impl __sdk::InModule for RemoteModule { - type Module = Self; -} - -/// The `reducers` field of [`EventContext`] and [`DbConnection`], -/// with methods provided by extension traits for each reducer defined by the module. -pub struct RemoteReducers { - imp: __sdk::DbContextImpl, -} - -impl __sdk::InModule for RemoteReducers { - type Module = RemoteModule; -} - -/// The `procedures` field of [`DbConnection`] and other [`DbContext`] types, -/// with methods provided by extension traits for each procedure defined by the module. -pub struct RemoteProcedures { - imp: __sdk::DbContextImpl, -} - -impl __sdk::InModule for RemoteProcedures { - type Module = RemoteModule; -} - -#[doc(hidden)] -/// The `set_reducer_flags` field of [`DbConnection`], -/// with methods provided by extension traits for each reducer defined by the module. -/// Each method sets the flags for the reducer with the same name. -/// -/// This type is currently unstable and may be removed without a major version bump. -pub struct SetReducerFlags { - imp: __sdk::DbContextImpl, -} - -impl __sdk::InModule for SetReducerFlags { - type Module = RemoteModule; -} - -/// The `db` field of [`EventContext`] and [`DbConnection`], -/// with methods provided by extension traits for each table defined by the module. -pub struct RemoteTables { - imp: __sdk::DbContextImpl, -} - -impl __sdk::InModule for RemoteTables { - type Module = RemoteModule; -} - -/// A connection to a remote module, including a materialized view of a subset of the database. -/// -/// Connect to a remote module by calling [`DbConnection::builder`] -/// and using the [`__sdk::DbConnectionBuilder`] builder-pattern constructor. -/// -/// You must explicitly advance the connection by calling any one of: -/// -/// - [`DbConnection::frame_tick`]. -/// - [`DbConnection::run_threaded`]. -/// - [`DbConnection::run_async`]. -/// - [`DbConnection::advance_one_message`]. -/// - [`DbConnection::advance_one_message_blocking`]. -/// - [`DbConnection::advance_one_message_async`]. -/// -/// Which of these methods you should call depends on the specific needs of your application, -/// but you must call one of them, or else the connection will never progress. -pub struct DbConnection { - /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. - pub db: RemoteTables, - /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. - pub reducers: RemoteReducers, - #[doc(hidden)] - /// Access to setting the call-flags of each reducer defined for each reducer defined by the module - /// via extension traits implemented for [`SetReducerFlags`]. - /// - /// This type is currently unstable and may be removed without a major version bump. - pub set_reducer_flags: SetReducerFlags, - - /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. - pub procedures: RemoteProcedures, - - imp: __sdk::DbContextImpl, -} - -impl __sdk::InModule for DbConnection { - type Module = RemoteModule; -} - -impl __sdk::DbContext for DbConnection { - type DbView = RemoteTables; - type Reducers = RemoteReducers; - type Procedures = RemoteProcedures; - type SetReducerFlags = SetReducerFlags; - - fn db(&self) -> &Self::DbView { - &self.db - } - fn reducers(&self) -> &Self::Reducers { - &self.reducers - } - fn procedures(&self) -> &Self::Procedures { - &self.procedures - } - fn set_reducer_flags(&self) -> &Self::SetReducerFlags { - &self.set_reducer_flags - } - - fn is_active(&self) -> bool { - self.imp.is_active() - } - - fn disconnect(&self) -> __sdk::Result<()> { - self.imp.disconnect() - } - - type SubscriptionBuilder = __sdk::SubscriptionBuilder; - - fn subscription_builder(&self) -> Self::SubscriptionBuilder { - __sdk::SubscriptionBuilder::new(&self.imp) - } - - fn try_identity(&self) -> Option<__sdk::Identity> { - self.imp.try_identity() - } - fn connection_id(&self) -> __sdk::ConnectionId { - self.imp.connection_id() - } - fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { - self.imp.try_connection_id() - } -} - -impl DbConnection { - /// Builder-pattern constructor for a connection to a remote module. - /// - /// See [`__sdk::DbConnectionBuilder`] for required and optional configuration for the new connection. - pub fn builder() -> __sdk::DbConnectionBuilder { - __sdk::DbConnectionBuilder::new() - } - - /// If any WebSocket messages are waiting, process one of them. - /// - /// Returns `true` if a message was processed, or `false` if the queue is empty. - /// Callers should invoke this message in a loop until it returns `false` - /// or for as much time is available to process messages. - /// - /// Returns an error if the connection is disconnected. - /// If the disconnection in question was normal, - /// i.e. the result of a call to [`__sdk::DbContext::disconnect`], - /// the returned error will be downcastable to [`__sdk::DisconnectedError`]. - /// - /// This is a low-level primitive exposed for power users who need significant control over scheduling. - /// Most applications should call [`Self::frame_tick`] each frame - /// to fully exhaust the queue whenever time is available. - pub fn advance_one_message(&self) -> __sdk::Result { - self.imp.advance_one_message() - } - - /// Process one WebSocket message, potentially blocking the current thread until one is received. - /// - /// Returns an error if the connection is disconnected. - /// If the disconnection in question was normal, - /// i.e. the result of a call to [`__sdk::DbContext::disconnect`], - /// the returned error will be downcastable to [`__sdk::DisconnectedError`]. - /// - /// This is a low-level primitive exposed for power users who need significant control over scheduling. - /// Most applications should call [`Self::run_threaded`] to spawn a thread - /// which advances the connection automatically. - pub fn advance_one_message_blocking(&self) -> __sdk::Result<()> { - self.imp.advance_one_message_blocking() - } - - /// Process one WebSocket message, `await`ing until one is received. - /// - /// Returns an error if the connection is disconnected. - /// If the disconnection in question was normal, - /// i.e. the result of a call to [`__sdk::DbContext::disconnect`], - /// the returned error will be downcastable to [`__sdk::DisconnectedError`]. - /// - /// This is a low-level primitive exposed for power users who need significant control over scheduling. - /// Most applications should call [`Self::run_async`] to run an `async` loop - /// which advances the connection when polled. - pub async fn advance_one_message_async(&self) -> __sdk::Result<()> { - self.imp.advance_one_message_async().await - } - - /// Process all WebSocket messages waiting in the queue, - /// then return without `await`ing or blocking the current thread. - pub fn frame_tick(&self) -> __sdk::Result<()> { - self.imp.frame_tick() - } - - /// Spawn a thread which processes WebSocket messages as they are received. - pub fn run_threaded(&self) -> std::thread::JoinHandle<()> { - self.imp.run_threaded() - } - - /// Run an `async` loop which processes WebSocket messages when polled. - pub async fn run_async(&self) -> __sdk::Result<()> { - self.imp.run_async().await - } -} - -impl __sdk::DbConnection for DbConnection { - fn new(imp: __sdk::DbContextImpl) -> Self { - Self { - db: RemoteTables { imp: imp.clone() }, - reducers: RemoteReducers { imp: imp.clone() }, - procedures: RemoteProcedures { imp: imp.clone() }, - set_reducer_flags: SetReducerFlags { imp: imp.clone() }, - imp, - } - } -} - -/// A handle on a subscribed query. -// TODO: Document this better after implementing the new subscription API. -#[derive(Clone)] -pub struct SubscriptionHandle { - imp: __sdk::SubscriptionHandleImpl, -} - -impl __sdk::InModule for SubscriptionHandle { - type Module = RemoteModule; -} - -impl __sdk::SubscriptionHandle for SubscriptionHandle { - fn new(imp: __sdk::SubscriptionHandleImpl) -> Self { - Self { imp } - } - - /// Returns true if this subscription has been terminated due to an unsubscribe call or an error. - fn is_ended(&self) -> bool { - self.imp.is_ended() - } - - /// Returns true if this subscription has been applied and has not yet been unsubscribed. - fn is_active(&self) -> bool { - self.imp.is_active() - } - - /// Unsubscribe from the query controlled by this `SubscriptionHandle`, - /// then run `on_end` when its rows are removed from the client cache. - fn unsubscribe_then(self, on_end: __sdk::OnEndedCallback) -> __sdk::Result<()> { - self.imp.unsubscribe_then(Some(on_end)) - } - - fn unsubscribe(self) -> __sdk::Result<()> { - self.imp.unsubscribe_then(None) - } -} - -/// Alias trait for a [`__sdk::DbContext`] connected to this module, -/// with that trait's associated types bounded to this module's concrete types. -/// -/// Users can use this trait as a boundary on definitions which should accept -/// either a [`DbConnection`] or an [`EventContext`] and operate on either. -pub trait RemoteDbContext: - __sdk::DbContext< - DbView = RemoteTables, - Reducers = RemoteReducers, - SetReducerFlags = SetReducerFlags, - SubscriptionBuilder = __sdk::SubscriptionBuilder, -> -{ -} -impl< - Ctx: __sdk::DbContext< - DbView = RemoteTables, - Reducers = RemoteReducers, - SetReducerFlags = SetReducerFlags, - SubscriptionBuilder = __sdk::SubscriptionBuilder, - >, - > RemoteDbContext for Ctx -{ -} - -/// An [`__sdk::DbContext`] augmented with a [`__sdk::Event`], -/// passed to [`__sdk::Table::on_insert`], [`__sdk::Table::on_delete`] and [`__sdk::TableWithPrimaryKey::on_update`] callbacks. -pub struct EventContext { - /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. - pub db: RemoteTables, - /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. - pub reducers: RemoteReducers, - /// Access to setting the call-flags of each reducer defined for each reducer defined by the module - /// via extension traits implemented for [`SetReducerFlags`]. - /// - /// This type is currently unstable and may be removed without a major version bump. - pub set_reducer_flags: SetReducerFlags, - /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. - pub procedures: RemoteProcedures, - /// The event which caused these callbacks to run. - pub event: __sdk::Event, - imp: __sdk::DbContextImpl, -} - -impl __sdk::AbstractEventContext for EventContext { - type Event = __sdk::Event; - fn event(&self) -> &Self::Event { - &self.event - } - fn new(imp: __sdk::DbContextImpl, event: Self::Event) -> Self { - Self { - db: RemoteTables { imp: imp.clone() }, - reducers: RemoteReducers { imp: imp.clone() }, - set_reducer_flags: SetReducerFlags { imp: imp.clone() }, - procedures: RemoteProcedures { imp: imp.clone() }, - event, - imp, - } - } -} - -impl __sdk::InModule for EventContext { - type Module = RemoteModule; -} - -impl __sdk::DbContext for EventContext { - type DbView = RemoteTables; - type Reducers = RemoteReducers; - type Procedures = RemoteProcedures; - type SetReducerFlags = SetReducerFlags; - - fn db(&self) -> &Self::DbView { - &self.db - } - fn reducers(&self) -> &Self::Reducers { - &self.reducers - } - fn procedures(&self) -> &Self::Procedures { - &self.procedures - } - fn set_reducer_flags(&self) -> &Self::SetReducerFlags { - &self.set_reducer_flags - } - - fn is_active(&self) -> bool { - self.imp.is_active() - } - - fn disconnect(&self) -> __sdk::Result<()> { - self.imp.disconnect() - } - - type SubscriptionBuilder = __sdk::SubscriptionBuilder; - - fn subscription_builder(&self) -> Self::SubscriptionBuilder { - __sdk::SubscriptionBuilder::new(&self.imp) - } - - fn try_identity(&self) -> Option<__sdk::Identity> { - self.imp.try_identity() - } - fn connection_id(&self) -> __sdk::ConnectionId { - self.imp.connection_id() - } - fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { - self.imp.try_connection_id() - } -} - -impl __sdk::EventContext for EventContext {} - -/// An [`__sdk::DbContext`] augmented with a [`__sdk::ReducerEvent`], -/// passed to on-reducer callbacks. -pub struct ReducerEventContext { - /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. - pub db: RemoteTables, - /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. - pub reducers: RemoteReducers, - /// Access to setting the call-flags of each reducer defined for each reducer defined by the module - /// via extension traits implemented for [`SetReducerFlags`]. - /// - /// This type is currently unstable and may be removed without a major version bump. - pub set_reducer_flags: SetReducerFlags, - /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. - pub procedures: RemoteProcedures, - /// The event which caused these callbacks to run. - pub event: __sdk::ReducerEvent, - imp: __sdk::DbContextImpl, -} - -impl __sdk::AbstractEventContext for ReducerEventContext { - type Event = __sdk::ReducerEvent; - fn event(&self) -> &Self::Event { - &self.event - } - fn new(imp: __sdk::DbContextImpl, event: Self::Event) -> Self { - Self { - db: RemoteTables { imp: imp.clone() }, - reducers: RemoteReducers { imp: imp.clone() }, - set_reducer_flags: SetReducerFlags { imp: imp.clone() }, - procedures: RemoteProcedures { imp: imp.clone() }, - event, - imp, - } - } -} - -impl __sdk::InModule for ReducerEventContext { - type Module = RemoteModule; -} - -impl __sdk::DbContext for ReducerEventContext { - type DbView = RemoteTables; - type Reducers = RemoteReducers; - type Procedures = RemoteProcedures; - type SetReducerFlags = SetReducerFlags; - - fn db(&self) -> &Self::DbView { - &self.db - } - fn reducers(&self) -> &Self::Reducers { - &self.reducers - } - fn procedures(&self) -> &Self::Procedures { - &self.procedures - } - fn set_reducer_flags(&self) -> &Self::SetReducerFlags { - &self.set_reducer_flags - } - - fn is_active(&self) -> bool { - self.imp.is_active() - } - - fn disconnect(&self) -> __sdk::Result<()> { - self.imp.disconnect() - } - - type SubscriptionBuilder = __sdk::SubscriptionBuilder; - - fn subscription_builder(&self) -> Self::SubscriptionBuilder { - __sdk::SubscriptionBuilder::new(&self.imp) - } - - fn try_identity(&self) -> Option<__sdk::Identity> { - self.imp.try_identity() - } - fn connection_id(&self) -> __sdk::ConnectionId { - self.imp.connection_id() - } - fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { - self.imp.try_connection_id() - } -} - -impl __sdk::ReducerEventContext for ReducerEventContext {} - -/// An [`__sdk::DbContext`] passed to procedure callbacks. -pub struct ProcedureEventContext { - /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. - pub db: RemoteTables, - /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. - pub reducers: RemoteReducers, - /// Access to setting the call-flags of each reducer defined for each reducer defined by the module - /// via extension traits implemented for [`SetReducerFlags`]. - /// - /// This type is currently unstable and may be removed without a major version bump. - pub set_reducer_flags: SetReducerFlags, - /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. - pub procedures: RemoteProcedures, - imp: __sdk::DbContextImpl, -} - -impl __sdk::AbstractEventContext for ProcedureEventContext { - type Event = (); - fn event(&self) -> &Self::Event { - &() - } - fn new(imp: __sdk::DbContextImpl, _event: Self::Event) -> Self { - Self { - db: RemoteTables { imp: imp.clone() }, - reducers: RemoteReducers { imp: imp.clone() }, - procedures: RemoteProcedures { imp: imp.clone() }, - set_reducer_flags: SetReducerFlags { imp: imp.clone() }, - imp, - } - } -} - -impl __sdk::InModule for ProcedureEventContext { - type Module = RemoteModule; -} - -impl __sdk::DbContext for ProcedureEventContext { - type DbView = RemoteTables; - type Reducers = RemoteReducers; - type Procedures = RemoteProcedures; - type SetReducerFlags = SetReducerFlags; - - fn db(&self) -> &Self::DbView { - &self.db - } - fn reducers(&self) -> &Self::Reducers { - &self.reducers - } - fn procedures(&self) -> &Self::Procedures { - &self.procedures - } - fn set_reducer_flags(&self) -> &Self::SetReducerFlags { - &self.set_reducer_flags - } - - fn is_active(&self) -> bool { - self.imp.is_active() - } - - fn disconnect(&self) -> __sdk::Result<()> { - self.imp.disconnect() - } - - type SubscriptionBuilder = __sdk::SubscriptionBuilder; - - fn subscription_builder(&self) -> Self::SubscriptionBuilder { - __sdk::SubscriptionBuilder::new(&self.imp) - } - - fn try_identity(&self) -> Option<__sdk::Identity> { - self.imp.try_identity() - } - fn connection_id(&self) -> __sdk::ConnectionId { - self.imp.connection_id() - } - fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { - self.imp.try_connection_id() - } -} - -impl __sdk::ProcedureEventContext for ProcedureEventContext {} - -/// An [`__sdk::DbContext`] passed to [`__sdk::SubscriptionBuilder::on_applied`] and [`SubscriptionHandle::unsubscribe_then`] callbacks. -pub struct SubscriptionEventContext { - /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. - pub db: RemoteTables, - /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. - pub reducers: RemoteReducers, - /// Access to setting the call-flags of each reducer defined for each reducer defined by the module - /// via extension traits implemented for [`SetReducerFlags`]. - /// - /// This type is currently unstable and may be removed without a major version bump. - pub set_reducer_flags: SetReducerFlags, - /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. - pub procedures: RemoteProcedures, - imp: __sdk::DbContextImpl, -} - -impl __sdk::AbstractEventContext for SubscriptionEventContext { - type Event = (); - fn event(&self) -> &Self::Event { - &() - } - fn new(imp: __sdk::DbContextImpl, _event: Self::Event) -> Self { - Self { - db: RemoteTables { imp: imp.clone() }, - reducers: RemoteReducers { imp: imp.clone() }, - procedures: RemoteProcedures { imp: imp.clone() }, - set_reducer_flags: SetReducerFlags { imp: imp.clone() }, - imp, - } - } -} - -impl __sdk::InModule for SubscriptionEventContext { - type Module = RemoteModule; -} - -impl __sdk::DbContext for SubscriptionEventContext { - type DbView = RemoteTables; - type Reducers = RemoteReducers; - type Procedures = RemoteProcedures; - type SetReducerFlags = SetReducerFlags; - - fn db(&self) -> &Self::DbView { - &self.db - } - fn reducers(&self) -> &Self::Reducers { - &self.reducers - } - fn procedures(&self) -> &Self::Procedures { - &self.procedures - } - fn set_reducer_flags(&self) -> &Self::SetReducerFlags { - &self.set_reducer_flags - } - - fn is_active(&self) -> bool { - self.imp.is_active() - } - - fn disconnect(&self) -> __sdk::Result<()> { - self.imp.disconnect() - } - - type SubscriptionBuilder = __sdk::SubscriptionBuilder; - - fn subscription_builder(&self) -> Self::SubscriptionBuilder { - __sdk::SubscriptionBuilder::new(&self.imp) - } - - fn try_identity(&self) -> Option<__sdk::Identity> { - self.imp.try_identity() - } - fn connection_id(&self) -> __sdk::ConnectionId { - self.imp.connection_id() - } - fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { - self.imp.try_connection_id() - } -} - -impl __sdk::SubscriptionEventContext for SubscriptionEventContext {} - -/// An [`__sdk::DbContext`] augmented with a [`__sdk::Error`], -/// passed to [`__sdk::DbConnectionBuilder::on_disconnect`], [`__sdk::DbConnectionBuilder::on_connect_error`] and [`__sdk::SubscriptionBuilder::on_error`] callbacks. -pub struct ErrorContext { - /// Access to tables defined by the module via extension traits implemented for [`RemoteTables`]. - pub db: RemoteTables, - /// Access to reducers defined by the module via extension traits implemented for [`RemoteReducers`]. - pub reducers: RemoteReducers, - /// Access to setting the call-flags of each reducer defined for each reducer defined by the module - /// via extension traits implemented for [`SetReducerFlags`]. - /// - /// This type is currently unstable and may be removed without a major version bump. - pub set_reducer_flags: SetReducerFlags, - /// Access to procedures defined by the module via extension traits implemented for [`RemoteProcedures`]. - pub procedures: RemoteProcedures, - /// The event which caused these callbacks to run. - pub event: Option<__sdk::Error>, - imp: __sdk::DbContextImpl, -} - -impl __sdk::AbstractEventContext for ErrorContext { - type Event = Option<__sdk::Error>; - fn event(&self) -> &Self::Event { - &self.event - } - fn new(imp: __sdk::DbContextImpl, event: Self::Event) -> Self { - Self { - db: RemoteTables { imp: imp.clone() }, - reducers: RemoteReducers { imp: imp.clone() }, - set_reducer_flags: SetReducerFlags { imp: imp.clone() }, - procedures: RemoteProcedures { imp: imp.clone() }, - event, - imp, - } - } -} - -impl __sdk::InModule for ErrorContext { - type Module = RemoteModule; -} - -impl __sdk::DbContext for ErrorContext { - type DbView = RemoteTables; - type Reducers = RemoteReducers; - type Procedures = RemoteProcedures; - type SetReducerFlags = SetReducerFlags; - - fn db(&self) -> &Self::DbView { - &self.db - } - fn reducers(&self) -> &Self::Reducers { - &self.reducers - } - fn procedures(&self) -> &Self::Procedures { - &self.procedures - } - fn set_reducer_flags(&self) -> &Self::SetReducerFlags { - &self.set_reducer_flags - } - - fn is_active(&self) -> bool { - self.imp.is_active() - } - - fn disconnect(&self) -> __sdk::Result<()> { - self.imp.disconnect() - } - - type SubscriptionBuilder = __sdk::SubscriptionBuilder; - - fn subscription_builder(&self) -> Self::SubscriptionBuilder { - __sdk::SubscriptionBuilder::new(&self.imp) - } - - fn try_identity(&self) -> Option<__sdk::Identity> { - self.imp.try_identity() - } - fn connection_id(&self) -> __sdk::ConnectionId { - self.imp.connection_id() - } - fn try_connection_id(&self) -> Option<__sdk::ConnectionId> { - self.imp.try_connection_id() - } -} - -impl __sdk::ErrorContext for ErrorContext {} - -impl __sdk::SpacetimeModule for RemoteModule { - type DbConnection = DbConnection; - type EventContext = EventContext; - type ReducerEventContext = ReducerEventContext; - type ProcedureEventContext = ProcedureEventContext; - type SubscriptionEventContext = SubscriptionEventContext; - type ErrorContext = ErrorContext; - type Reducer = Reducer; - type DbView = RemoteTables; - type Reducers = RemoteReducers; - type SetReducerFlags = SetReducerFlags; - type DbUpdate = DbUpdate; - type AppliedDiff<'r> = AppliedDiff<'r>; - type SubscriptionHandle = SubscriptionHandle; - - fn register_tables(client_cache: &mut __sdk::ClientCache) { - drawn_table::register_table(client_cache); - hand_table::register_table(client_cache); - player_table::register_table(client_cache); - table_table::register_table(client_cache); - wall_table::register_table(client_cache); - } -} diff --git a/jong/src/jongline_bindings/player_table.rs b/jong/src/jongline_bindings/player_table.rs deleted file mode 100644 index 3014fc8..0000000 --- a/jong/src/jongline_bindings/player_table.rs +++ /dev/null @@ -1,95 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::player_type::Player; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `player`. -/// -/// Obtain a handle from the [`PlayerTableAccess::player`] method on [`super::RemoteTables`], -/// like `ctx.db.player()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player().on_insert(...)`. -pub struct PlayerTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `player`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait PlayerTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`PlayerTableHandle`], which mediates access to the table `player`. - fn player(&self) -> PlayerTableHandle<'_>; -} - -impl PlayerTableAccess for super::RemoteTables { - fn player(&self) -> PlayerTableHandle<'_> { - PlayerTableHandle { - imp: self.imp.get_table::("player"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct PlayerInsertCallbackId(__sdk::CallbackId); -pub struct PlayerDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for PlayerTableHandle<'ctx> { - type Row = Player; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = PlayerInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PlayerInsertCallbackId { - PlayerInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: PlayerInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = PlayerDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PlayerDeleteCallbackId { - PlayerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: PlayerDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("player"); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} diff --git a/jong/src/jongline_bindings/player_type.rs b/jong/src/jongline_bindings/player_type.rs deleted file mode 100644 index 871ae30..0000000 --- a/jong/src/jongline_bindings/player_type.rs +++ /dev/null @@ -1,17 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub struct Player { - pub username: String, - pub identity: __sdk::Identity, - pub connection_id: __sdk::ConnectionId, -} - -impl __sdk::InModule for Player { - type Module = super::RemoteModule; -} diff --git a/jong/src/jongline_bindings/table_table.rs b/jong/src/jongline_bindings/table_table.rs deleted file mode 100644 index 9b05b54..0000000 --- a/jong/src/jongline_bindings/table_table.rs +++ /dev/null @@ -1,97 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::hand_type::Hand; -use super::player_type::Player; -use super::table_type::Table; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `table`. -/// -/// Obtain a handle from the [`TableTableAccess::table`] method on [`super::RemoteTables`], -/// like `ctx.db.table()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.table().on_insert(...)`. -pub struct TableTableHandle<'ctx> { - imp: __sdk::TableHandle
, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `table`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait TableTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`TableTableHandle`], which mediates access to the table `table`. - fn table(&self) -> TableTableHandle<'_>; -} - -impl TableTableAccess for super::RemoteTables { - fn table(&self) -> TableTableHandle<'_> { - TableTableHandle { - imp: self.imp.get_table::
("table"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct TableInsertCallbackId(__sdk::CallbackId); -pub struct TableDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for TableTableHandle<'ctx> { - type Row = Table; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = TableInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> TableInsertCallbackId { - TableInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: TableInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = TableDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> TableDeleteCallbackId { - TableDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: TableDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::
("table"); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate
> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate
", "TableUpdate") - .with_cause(e) - .into() - }) -} diff --git a/jong/src/jongline_bindings/table_type.rs b/jong/src/jongline_bindings/table_type.rs deleted file mode 100644 index 4d03385..0000000 --- a/jong/src/jongline_bindings/table_type.rs +++ /dev/null @@ -1,19 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -use super::hand_type::Hand; -use super::player_type::Player; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub struct Table { - pub players: Player, - pub hands: Vec, -} - -impl __sdk::InModule for Table { - type Module = super::RemoteModule; -} diff --git a/jong/src/jongline_bindings/wall_table.rs b/jong/src/jongline_bindings/wall_table.rs deleted file mode 100644 index 8657bf9..0000000 --- a/jong/src/jongline_bindings/wall_table.rs +++ /dev/null @@ -1,95 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use super::wall_type::Wall; -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -/// Table handle for the table `wall`. -/// -/// Obtain a handle from the [`WallTableAccess::wall`] method on [`super::RemoteTables`], -/// like `ctx.db.wall()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.wall().on_insert(...)`. -pub struct WallTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `wall`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait WallTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`WallTableHandle`], which mediates access to the table `wall`. - fn wall(&self) -> WallTableHandle<'_>; -} - -impl WallTableAccess for super::RemoteTables { - fn wall(&self) -> WallTableHandle<'_> { - WallTableHandle { - imp: self.imp.get_table::("wall"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct WallInsertCallbackId(__sdk::CallbackId); -pub struct WallDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for WallTableHandle<'ctx> { - type Row = Wall; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { - self.imp.count() - } - fn iter(&self) -> impl Iterator + '_ { - self.imp.iter() - } - - type InsertCallbackId = WallInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> WallInsertCallbackId { - WallInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: WallInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = WallDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> WallDeleteCallbackId { - WallDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: WallDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - let _table = client_cache.get_or_make_table::("wall"); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::TableUpdate<__ws::BsatnFormat>, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse("TableUpdate", "TableUpdate") - .with_cause(e) - .into() - }) -} diff --git a/jong/src/jongline_bindings/wall_type.rs b/jong/src/jongline_bindings/wall_type.rs deleted file mode 100644 index 2056ff5..0000000 --- a/jong/src/jongline_bindings/wall_type.rs +++ /dev/null @@ -1,13 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub struct Wall {} - -impl __sdk::InModule for Wall { - type Module = super::RemoteModule; -} diff --git a/jong/src/lib.rs b/jong/src/lib.rs index 4fcaff4..eaa491e 100644 --- a/jong/src/lib.rs +++ b/jong/src/lib.rs @@ -3,8 +3,8 @@ use bevy::prelude::*; use bevy_spacetimedb::StdbConnection; -mod jongline_bindings; -use jongline_bindings::*; +// mod jongline_bindings; +// use jongline_bindings::*; pub mod game; pub mod tile; @@ -14,4 +14,4 @@ trait EnumNextCycle { fn next(&self) -> Self; } -pub type SpacetimeDb<'a> = Res<'a, StdbConnection>; +// pub type SpacetimeDb<'a> = Res<'a, StdbConnection>; diff --git a/jong/src/main.rs b/jong/src/main.rs index 2b2c4d3..53ed662 100644 --- a/jong/src/main.rs +++ b/jong/src/main.rs @@ -47,13 +47,13 @@ fn main() { } }; - app.add_plugins( - StdbPlugin::default() - .with_uri("http://localhost:3000") - .with_module_name("jongline") - .with_run_fn(DbConnection::run_threaded) - .add_partial_table(RemoteTables::players, TableMessages::no_update()), - ); + // app.add_plugins( + // StdbPlugin::default() + // .with_uri("http://localhost:3000") + // .with_module_name("jongline") + // .with_run_fn(DbConnection::run_threaded) + // .add_partial_table(RemoteTables::players, TableMessages::no_update()), + // ); app.add_plugins(jong::game::Riichi); diff --git a/jong/src/tui/input/keyboard.rs b/jong/src/tui/input/keyboard.rs index 62e8648..b879f77 100644 --- a/jong/src/tui/input/keyboard.rs +++ b/jong/src/tui/input/keyboard.rs @@ -1,6 +1,7 @@ use bevy::prelude::*; +use bevy_ratatui::crossterm::event::KeyCode; use bevy_ratatui::event::KeyMessage; -use ratatui::crossterm::event::KeyCode; +// use ratatui::crossterm::event::KeyCode; use tui_logger::TuiWidgetEvent; use jong::game::GameState; diff --git a/jong/src/tui/input/mouse.rs b/jong/src/tui/input/mouse.rs index cf86f04..c828eec 100644 --- a/jong/src/tui/input/mouse.rs +++ b/jong/src/tui/input/mouse.rs @@ -1,4 +1,5 @@ use bevy::prelude::*; +use bevy_ratatui::crossterm::event::{MouseButton, MouseEventKind}; use bevy_ratatui::event::MouseMessage; use ratatui::layout::Position; @@ -21,8 +22,8 @@ pub(crate) fn mouse( let position = Position::new(event.column, event.row); match event.kind { #[allow(clippy::single_match)] - ratatui::crossterm::event::MouseEventKind::Down(mouse_button) => match mouse_button { - ratatui::crossterm::event::MouseButton::Left => { + MouseEventKind::Down(mouse_button) => match mouse_button { + MouseButton::Left => { for (entity, region) in &entities { if region.area.contains(position) { commands.entity(entity).insert(StartSelect); @@ -34,7 +35,7 @@ pub(crate) fn mouse( // ratatui::crossterm::event::MouseButton::Middle => debug!("unhandled mouse event"), _ => {} }, - ratatui::crossterm::event::MouseEventKind::Moved => { + MouseEventKind::Moved => { for (entity, region) in &hovered { if !region.area.contains(position) { commands.entity(entity).remove::(); @@ -46,8 +47,8 @@ pub(crate) fn mouse( } } } - ratatui::crossterm::event::MouseEventKind::Up(mouse_button) => match mouse_button { - ratatui::crossterm::event::MouseButton::Left => { + MouseEventKind::Up(mouse_button) => match mouse_button { + MouseButton::Left => { for (entity, region) in &startselected { if region.area.contains(position) { commands.entity(entity).remove::(); @@ -55,7 +56,7 @@ pub(crate) fn mouse( } } } - ratatui::crossterm::event::MouseButton::Right => { + MouseButton::Right => { for (entity, _) in &startselected { commands.entity(entity).remove::(); } @@ -63,19 +64,19 @@ pub(crate) fn mouse( // ratatui::crossterm::event::MouseButton::Middle => debug!("unhandled mouse event"), _ => {} }, - ratatui::crossterm::event::MouseEventKind::Drag(mouse_button) => { + MouseEventKind::Drag(mouse_button) => { // debug!("unhandled mouse event") } - ratatui::crossterm::event::MouseEventKind::ScrollDown => { + MouseEventKind::ScrollDown => { // debug!("unhandled mouse event") } - ratatui::crossterm::event::MouseEventKind::ScrollUp => { + MouseEventKind::ScrollUp => { // debug!("unhandled mouse event") } - ratatui::crossterm::event::MouseEventKind::ScrollLeft => { + MouseEventKind::ScrollLeft => { // debug!("unhandled mouse event") } - ratatui::crossterm::event::MouseEventKind::ScrollRight => { + MouseEventKind::ScrollRight => { // debug!("unhandled mouse event") } } diff --git a/jongline/Cargo.toml b/jongline/Cargo.toml deleted file mode 100644 index 7667498..0000000 --- a/jongline/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "jongline" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lib] -crate-type = ["cdylib"] - -[dependencies] -spacetimedb = "1.11.*" -log = "0.4" -# jong = { version = "0.1.0", path = "../jong" } diff --git a/jongline/src/lib.rs b/jongline/src/lib.rs deleted file mode 100644 index 257a2f1..0000000 --- a/jongline/src/lib.rs +++ /dev/null @@ -1,67 +0,0 @@ -use spacetimedb::{reducer, ConnectionId, Identity, ReducerContext}; - -// use jong::tile::Tile; - -#[spacetimedb::table(name = player)] -pub struct Player { - username: String, - - identity: Identity, - connection_id: ConnectionId, -} - -#[spacetimedb::table(name = table, public)] -pub struct Table { - players: Player, - hands: Vec, -} - -#[spacetimedb::table(name = wall)] -pub struct Wall { - // tiles: Vec, -} - -#[spacetimedb::table(name = hand)] -pub struct Hand { - // hand: Vec, -} - -#[spacetimedb::table(name = drawn)] -pub struct Drawn { - // tile: Tile, -} - -#[reducer(init)] -pub fn init(_ctx: &ReducerContext) { - // Called when the module is initially published -} - -#[reducer(client_connected)] -pub fn identity_connected(ctx: &ReducerContext) { - // Called everytime a new client connects -} - -// Called everytime a client disconnects -#[reducer(client_disconnected)] -pub fn identity_disconnected(ctx: &ReducerContext) { - // ctx.db.player().identity().delete(ctx.sender); -} - -#[reducer] -pub fn create_player(ctx: &ReducerContext, username: String) { - let connection_id = ctx.connection_id.unwrap(); - let identity = ctx.identity(); - // ctx.db.player().insert(Player { - // username, - // connection_id, - // identity, - // }); -} - -// #[spacetimedb::reducer] -// pub fn say_hello(ctx: &ReducerContext) { -// for person in ctx.db.person().iter() { -// log::info!("Hello, {}!", person.name); -// } -// log::info!("Hello, World!"); -// }