From 7f059c77826469c380ad91385fec635cb2b58ed7 Mon Sep 17 00:00:00 2001 From: JIe Date: Tue, 10 Dec 2024 18:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=80=BB=E8=BE=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90,=20ui=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 1353 ++++++++++++++++++++++++++++++++++++++- Cargo.toml | 10 +- src/download_wrapper.rs | 249 +++++++ src/main.rs | 269 ++++++-- src/mes_service.rs | 10 +- 5 files changed, 1811 insertions(+), 80 deletions(-) create mode 100644 src/download_wrapper.rs diff --git a/Cargo.lock b/Cargo.lock index 24a401f..7a58fb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,15 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + [[package]] name = "adler2" version = "2.0.0" @@ -48,6 +57,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "allocator-api2" version = "0.2.21" @@ -81,6 +99,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -287,6 +311,64 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bigdecimal" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f31f3af01c5c65a07985c804d3366560e6fa7883d640a122819b14ec327482c" +dependencies = [ + "autocfg", + "libm", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "bindgen" +version = "0.71.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360897d4f2fdeea5d32f6dac9287952ae5babdc2aad42ad787c9470a4a6e3fee" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.0", + "shlex", + "syn 2.0.90", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -314,6 +396,18 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block" version = "0.1.6" @@ -351,6 +445,44 @@ dependencies = [ "piper", ] +[[package]] +name = "borsh" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" +dependencies = [ + "borsh-derive", + "cfg_aliases 0.2.1", +] + +[[package]] +name = "borsh-derive" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "btoi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd6407f73a9b8b6162d8a2ef999fe6afd7cc15902ebf42c5cd296addf17e0ad" +dependencies = [ + "num-traits", +] + +[[package]] +name = "bufstream" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8" + [[package]] name = "bumpalo" version = "3.16.0" @@ -363,6 +495,28 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" +[[package]] +name = "bytecheck" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "bytemuck" version = "1.20.0" @@ -438,6 +592,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -456,6 +619,31 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets 0.52.6", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading 0.8.6", +] + [[package]] name = "clipboard-win" version = "5.4.0" @@ -495,6 +683,15 @@ dependencies = [ "x11rb", ] +[[package]] +name = "cmake" +version = "0.1.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +dependencies = [ + "cc", +] + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -590,7 +787,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.4", "core-graphics-types 0.1.3", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -603,7 +800,7 @@ dependencies = [ "bitflags 2.6.0", "core-foundation 0.10.0", "core-graphics-types 0.2.0", - "foreign-types", + "foreign-types 0.5.0", "libc", ] @@ -670,6 +867,28 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -689,6 +908,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -750,12 +978,67 @@ dependencies = [ "zbus", ] +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.90", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.90", +] + [[package]] name = "dconf_rs" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7046468a81e6a002061c01e6a7c83139daf91b11c30e66795b13217c2d885c8b" +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derive_utils" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65f152f4b8559c4da5d574bafc7af85454d706b4c5fe8b530d508cacbb6807ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "detect-desktop-environment" version = "0.2.0" @@ -798,6 +1081,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "dlib" version = "0.5.2" @@ -987,9 +1281,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", + "libz-sys", "miniz_oxide", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "font-types" version = "0.7.3" @@ -1022,6 +1329,15 @@ dependencies = [ "ttf-parser 0.20.0", ] +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + [[package]] name = "foreign-types" version = "0.5.0" @@ -1029,7 +1345,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared", + "foreign-types-shared 0.3.1", ] [[package]] @@ -1043,12 +1359,89 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "foreign-types-shared" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "frunk" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874b6a17738fc273ec753618bac60ddaeac48cb1d7684c3e7bd472e57a28b817" +dependencies = [ + "frunk_core", + "frunk_derives", + "frunk_proc_macros", + "serde", +] + +[[package]] +name = "frunk_core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3529a07095650187788833d585c219761114005d5976185760cf794d265b6a5c" +dependencies = [ + "serde", +] + +[[package]] +name = "frunk_derives" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e99b8b3c28ae0e84b604c75f721c21dc77afb3706076af5e8216d15fd1deaae3" +dependencies = [ + "frunk_proc_macro_helpers", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "frunk_proc_macro_helpers" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05a956ef36c377977e512e227dcad20f68c2786ac7a54dacece3746046fea5ce" +dependencies = [ + "frunk_core", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "frunk_proc_macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e86c2c9183662713fea27ea527aad20fb15fee635a71081ff91bf93df4dc51" +dependencies = [ + "frunk_core", + "frunk_proc_macro_helpers", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.3.31" @@ -1183,6 +1576,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + [[package]] name = "gl_generator" version = "0.14.0" @@ -1200,6 +1599,12 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "glow" version = "0.13.1" @@ -1317,6 +1722,11 @@ name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] [[package]] name = "hassle-rs" @@ -1333,6 +1743,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -1357,6 +1773,29 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "iced" version = "0.13.1" @@ -1401,6 +1840,7 @@ dependencies = [ "iced_core", "log", "rustc-hash 2.1.0", + "tokio", "wasm-bindgen-futures", "wasm-timer", ] @@ -1535,6 +1975,151 @@ dependencies = [ "winit", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "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 2.0.90", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" version = "2.7.0" @@ -1554,6 +2139,24 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-enum" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b53d712d99a73eec59ee5e4fe6057f8052142d38eeafbbffcb06b36d738a6e" +dependencies = [ + "derive_utils", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.14" @@ -1628,6 +2231,12 @@ dependencies = [ "smallvec", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.167" @@ -1671,6 +2280,17 @@ dependencies = [ "redox_syscall 0.5.7", ] +[[package]] +name = "libz-sys" +version = "1.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1683,6 +2303,12 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a385b1be4e5c3e362ad2ffa73c392e53f031eaa5b7d648e64cd87f27f6063d7" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "lock_api" version = "0.4.12" @@ -1704,6 +2330,9 @@ name = "lru" version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.2", +] [[package]] name = "malloc_buf" @@ -1747,12 +2376,18 @@ dependencies = [ "bitflags 2.6.0", "block", "core-graphics-types 0.1.3", - "foreign-types", + "foreign-types 0.5.0", "log", "objc", "paste", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.0" @@ -1763,6 +2398,99 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "mysql" +version = "25.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6ad644efb545e459029b1ffa7c969d830975bd76906820913247620df10050b" +dependencies = [ + "bufstream", + "bytes", + "crossbeam", + "flate2", + "io-enum", + "libc", + "lru", + "mysql_common", + "named_pipe", + "native-tls", + "pem", + "percent-encoding", + "serde", + "serde_json", + "socket2", + "twox-hash", + "url", +] + +[[package]] +name = "mysql-common-derive" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63c3512cf11487168e0e9db7157801bf5273be13055a9cc95356dc9e0035e49c" +dependencies = [ + "darling", + "heck", + "num-bigint", + "proc-macro-crate", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.90", + "termcolor", + "thiserror", +] + +[[package]] +name = "mysql_common" +version = "0.32.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478b0ff3f7d67b79da2b96f56f334431aef65e15ba4b29dd74a4236e29582bdc" +dependencies = [ + "base64 0.21.7", + "bigdecimal", + "bindgen", + "bitflags 2.6.0", + "bitvec", + "btoi", + "byteorder", + "bytes", + "cc", + "cmake", + "crc32fast", + "flate2", + "frunk", + "lazy_static", + "mysql-common-derive", + "num-bigint", + "num-traits", + "rand", + "regex", + "rust_decimal", + "saturating", + "serde", + "serde_json", + "sha1", + "sha2", + "smallvec", + "subprocess", + "thiserror", + "time", + "uuid", + "zstd", +] + [[package]] name = "naga" version = "0.19.2" @@ -1783,6 +2511,32 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "named_pipe" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad9c443cce91fc3e12f017290db75dde490d685cdaaf508d7159d7cf41f0eb2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "ndk" version = "0.9.0" @@ -1835,6 +2589,41 @@ dependencies = [ "memoffset", ] +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2097,12 +2886,65 @@ dependencies = [ "cc", ] +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "openssl" +version = "0.10.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "orbclient" version = "0.3.48" @@ -2225,6 +3067,16 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64 0.22.1", + "serde", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -2350,6 +3202,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -2374,6 +3232,28 @@ dependencies = [ "toml_edit", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "proc-macro2" version = "1.0.92" @@ -2389,6 +3269,26 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "quick-xml" version = "0.36.2" @@ -2407,6 +3307,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" @@ -2523,12 +3429,79 @@ dependencies = [ "thiserror", ] +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rend" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +dependencies = [ + "bytecheck", +] + [[package]] name = "renderdoc-sys" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" +[[package]] +name = "rkyv" +version = "0.7.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" +dependencies = [ + "bitvec", + "bytecheck", + "bytes", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "roxmltree" version = "0.20.0" @@ -2545,6 +3518,28 @@ dependencies = [ "ordered-multimap", ] +[[package]] +name = "rust_decimal" +version = "1.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" +dependencies = [ + "arrayvec", + "borsh", + "bytes", + "num-traits", + "rand", + "rkyv", + "serde", + "serde_json", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -2602,6 +3597,21 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "saturating" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71" + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -2627,6 +3637,35 @@ dependencies = [ "tiny-skia", ] +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "self_cell" version = "1.1.0" @@ -2687,6 +3726,17 @@ dependencies = [ "digest", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shlex" version = "1.3.0" @@ -2708,6 +3758,12 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + [[package]] name = "siphasher" version = "0.3.11" @@ -2793,6 +3849,16 @@ dependencies = [ "serde", ] +[[package]] +name = "socket2" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "softbuffer" version = "0.4.6" @@ -2805,7 +3871,7 @@ dependencies = [ "core-graphics 0.24.0", "drm", "fastrand", - "foreign-types", + "foreign-types 0.5.0", "js-sys", "log", "memmap2", @@ -2834,6 +3900,12 @@ dependencies = [ "bitflags 2.6.0", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -2846,6 +3918,22 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subprocess" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "svg_fmt" version = "0.4.4" @@ -2885,6 +3973,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "sys-locale" version = "0.3.2" @@ -2894,6 +3993,12 @@ dependencies = [ "libc", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.14.0" @@ -2936,6 +4041,36 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "time" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tiny-skia" version = "0.11.4" @@ -2975,6 +4110,16 @@ dependencies = [ "tracing", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -2990,6 +4135,35 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot 0.12.3", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "toml_datetime" version = "0.6.8" @@ -3056,6 +4230,17 @@ version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "rand", + "static_assertions", +] + [[package]] name = "typenum" version = "1.17.0" @@ -3133,6 +4318,41 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -3824,9 +5044,37 @@ name = "wisun_download_rust" version = "0.1.0" dependencies = [ "anyhow", + "chrono", + "crossbeam", "iced", + "lazy_static", + "log", + "mysql", "serde", "serde_json", + "time", + "tokio", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", ] [[package]] @@ -3908,6 +5156,30 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c94451ac9513335b5e23d7a8a2b61a7102398b8cca5160829d313e84c9d98be1" +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "synstructure", +] + [[package]] name = "zbus" version = "4.4.0" @@ -3997,6 +5269,77 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] + [[package]] name = "zvariant" version = "4.2.0" diff --git a/Cargo.toml b/Cargo.toml index 7c60599..2ac5c5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,18 @@ version = "0.1.0" edition = "2021" [dependencies] -iced = "0.13.1" +iced = {version = "0.13.1", features = ["tokio", "debug"]} anyhow = "1.0.91" serde = {version = "1.0.213", features = ["derive"]} serde_json = "1.0.132" +mysql = "25.0.1" +chrono="0.4.38" +tokio = { version = "1.42", features = ["full"] } +log = "0.4.22" +lazy_static = "1.5.0" +time = "0.3.37" +crossbeam = "0.8" + [package.metadata.windows] link-args=["/SUBSYSTEM:WINDOWS"] diff --git a/src/download_wrapper.rs b/src/download_wrapper.rs new file mode 100644 index 0000000..8d2be26 --- /dev/null +++ b/src/download_wrapper.rs @@ -0,0 +1,249 @@ +use crate::download_wrapper::DownloadError::JlinkNotFindError; +use anyhow::Error; +use std::path::{Path, PathBuf}; +use std::process::Command; + +pub struct DownloadWrapper { + commander_path: PathBuf, + bin_path: PathBuf, + bootloader_name: String, + app_name: String, + rail_name: String, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum DownloadType { + Bootloader, + App, + Rail, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum DownloadError { + JlinkNotFindError, + DeviceNotFindError, + EraseError, + DownloadBootloaderError, + DownloadAppError, + DownloadRailError, +} + +impl Default for DownloadWrapper { + fn default() -> Self { + Self { + commander_path: PathBuf::from(std::env::current_dir().unwrap()) + .join("commander/Simplicity Commander/commander.exe"), + bin_path: PathBuf::from(std::env::current_dir().unwrap()).join("bin/"), + bootloader_name: String::from("RAWM00-2-0-0_silicon-wisun_bootloader_D20241008.s37"), + app_name: String::from("RAWM00-2-0-0_silicon-wisun_APP-V1_D20240927.s37"), + rail_name: String::from("rail_soc_railtest_sisdk.s37"), + } + } +} + +impl DownloadWrapper { + pub(crate) fn new() -> Self { + Self::default() + } + + pub fn check_jlink(&self) -> Result, DownloadError> { + let commander_path_str = self.commander_path.to_str().unwrap(); + let output = Command::new(commander_path_str) + .arg("adapter") + .arg("list") + .output() + .expect("Failed to execute command"); + if output.status.success() { + let result_str = String::from_utf8_lossy(&output.stdout).to_string(); + let result = result_str + .split("\r\n") + .collect::>(); + let device_index_str: Vec = result + .iter() + .filter(|&&str| str.starts_with("deviceCount")) + .map(|&str| str.to_string()) + .collect(); + if device_index_str.is_empty() + || device_index_str[0].split("=").collect::>()[1] == "0" + { + Err(JlinkNotFindError) + } else { + let device_ids = result + .iter() + .filter(|&&str| str.trim().starts_with("serialNumber")) + .map(|&str| { + let temp = str.to_string(); + return temp.split("=").collect::>()[1].to_string(); + }) + .collect::>(); + Ok(device_ids) + } + } else { + Err(JlinkNotFindError) + } + } + + pub fn check_device(&self) -> Result<(), DownloadError> { + let commander_path_str = self.commander_path.to_str().unwrap(); + let output = Command::new(commander_path_str) + .arg("device") + .arg("info") + .arg("--device") + .arg("Cortex-M4") + .output() + .expect("Failed to execute command"); + let stdout = String::from_utf8_lossy(&output.stdout).to_string(); + let result = stdout.split("\r\n").collect::>(); + let error_log = result + .iter() + .filter(|&&str| str.trim().starts_with("ERROR")) + .collect::>(); + if error_log.is_empty() { + Ok(()) + } else { + Err(DownloadError::DeviceNotFindError) + } + } + + pub fn erase(&self) -> Result<(), DownloadError> { + let commander_path_str = self.commander_path.to_str().unwrap(); + let output = Command::new(commander_path_str) + .arg("device") + .arg("masserase") + .arg("--device") + .arg("Cortex-M4") + .output() + .expect("Failed to execute command"); + let result_str = String::from_utf8_lossy(&output.stdout).to_string(); + let result = result_str + .split("\r\n") + .collect::>(); + if !result + .iter() + .filter(|&&str| str.trim().starts_with("ERROR")) + .collect::>() + .is_empty() + || result + .iter() + .filter(|&&str| str.trim().contains("successfully")) + .collect::>() + .is_empty() + { + Err(DownloadError::EraseError) + } else { + Ok(()) + } + } + + pub fn download(&self, download_type: DownloadType) -> Result<(), DownloadError> { + let mut binding: PathBuf; + match download_type { + DownloadType::Bootloader=> { + binding = self.bin_path.join(&self.bootloader_name); + } + DownloadType::App=>{ + binding = self.bin_path.join(&self.app_name); + } + DownloadType::Rail=>{ + binding = self.bin_path.join(&self.rail_name); + } + } + let bin_path = binding.to_str().unwrap(); + println!("{:?}", bin_path); + let commander_path_str = self.commander_path.to_str().unwrap(); + let output = Command::new(commander_path_str) + .arg("flash") + .arg(bin_path) + .arg("--device") + .arg("Cortex-M4") + .output() + .expect("Failed to execute command"); + let result_str = String::from_utf8_lossy(&output.stdout).to_string(); + let result = result_str + .split("\r\n") + .collect::>(); + println!("{:?}", result); + if !result + .iter() + .filter(|&&str| str.trim().starts_with("ERROR")) + .collect::>() + .is_empty() + || result + .iter() + .filter(|&&str| str.trim().contains("successfully")) + .collect::>() + .is_empty() + { + Err(DownloadError::DownloadBootloaderError) + } else { + Ok(()) + } + } + + pub fn download_app(&self) -> Result { + todo!() + } + + pub fn download_rail(&self) -> Result { + todo!() + } +} + +#[cfg(test)] +mod test { + use crate::download_wrapper::DownloadWrapper; + use crate::download_wrapper::DownloadType; + + #[test] + fn test_download_wrapper() { + let dw = DownloadWrapper::new(); + println!("{:?}", dw.commander_path); + println!("{:?}", dw.bin_path); + println!("{:?}", dw.bootloader_name); + println!("{:?}", dw.app_name); + println!("{:?}", dw.rail_name); + } + + #[test] + fn test_check_jlink() { + let dw = DownloadWrapper::new(); + let result = dw.check_jlink(); + assert_eq!(result.is_ok(), true); + println!("ids:{:?}", result.unwrap()); + } + + #[test] + fn test_check_device() { + let dw = DownloadWrapper::new(); + let result = dw.check_device(); + assert_eq!(result.is_ok(), true); + } + + #[test] + fn test_erase_device() { + let dw = DownloadWrapper::new(); + let result = dw.erase(); + assert_eq!(result.is_ok(), true); + } + + #[test] + fn test_download_bootloader(){ + let dw = DownloadWrapper::new(); + let result = dw.download(DownloadType::Bootloader); + assert_eq!(result.is_ok(), true); + } + + #[test] + fn test_download_app(){ + let dw = DownloadWrapper::new(); + let result = dw.download(DownloadType::App); + assert_eq!(result.is_ok(), true); + } + + #[test] + fn test_download_rail(){ + let dw = DownloadWrapper::new(); + let result = dw.download(DownloadType::Rail); + assert_eq!(result.is_ok(), true); + } +} diff --git a/src/main.rs b/src/main.rs index ccdf635..2339cfa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,20 @@ mod download_wrapper; +mod mes_service; - -use iced::widget::{button, checkbox, column, container, radio, row, text_editor, text_input}; -use iced::{event, window, Element, Event, Length, Subscription, Task}; +use std::any::Any; +use crossbeam::channel; +use std::sync::{Arc, Mutex, LazyLock}; +use crossbeam::channel::Sender; +use iced::widget::{button, checkbox, column, container, radio, row, text_editor, text_input}; +use iced::{event, window, Element, Event, Length, Subscription, Task, time}; +use iced::application::Title; use iced::widget::text_editor::Action::Scroll; use iced::widget::text_editor::Edit; -pub fn main() ->iced::Result { +use download_wrapper::DownloadType; +use crate::mes_service::MesService; + +pub fn main() -> iced::Result { iced::application("WisunDownload V0.1", MainWindow::update, MainWindow::view) .subscription(MainWindow::subscription) .exit_on_close_request(false) @@ -14,29 +22,37 @@ pub fn main() ->iced::Result { .run() } +static logs: LazyLock>>> = LazyLock::new(|| { + Arc::new(Mutex::new(Vec::new())) +}); + struct MainWindow { is_online: bool, mysql_config: MysqlConfig, selection: Option, label: String, log_content: text_editor::Content, + sender: Sender, + receiver: crossbeam::channel::Receiver, } impl Default for MainWindow { - fn default() -> Self { - Self{ - is_online: true, - mysql_config: MysqlConfig::default(), - selection: None, - label: String::new(), - log_content: text_editor::Content::default(), - - } - } + fn default() -> Self { + let (sender, receiver) = crossbeam::channel::unbounded(); + Self { + is_online: true, + mysql_config: MysqlConfig::default(), + selection: None, + label: String::new(), + log_content: text_editor::Content::default(), + sender, + receiver + } + } } #[derive(Debug, Clone, Default)] -struct MysqlConfig{ +struct MysqlConfig { ip: String, port: String, username: String, @@ -45,7 +61,7 @@ struct MysqlConfig{ work_order: String, } #[derive(Debug, Clone)] -enum Message{ +enum Message { Start(), IpChanged(String), PortChanged(String), @@ -59,32 +75,22 @@ enum Message{ AddLog(String), LogContentChanged(text_editor::Action), SaveConfig, - WindowEvent(Event) + DownloadEnd(bool), + WindowEvent(Event), + Tick, } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -enum DownloadType{ - BootLoader, - App, - Cal +pub fn add_log<'a>(msg: String) { + let time_now = chrono::Local::now().format("%Y-%m-%d %H:%M:%S").to_string(); + let really_msg = format!("{time_now} [Info]: {msg}"); + logs.lock().unwrap().push(really_msg); } -impl MainWindow{ - pub fn add_log(&mut self, msg: String) -> Task{ - self.update(Message::AddLog(msg)) - } - - fn update(&mut self, message: Message)-> Task{ - match message{ +impl MainWindow { + fn update(&mut self, message: Message) -> Task { + match message { Message::Start() => { - println!("Start: {:?}", self.mysql_config); - println!("Start: {:?}", self.is_online); - println!("Start: {:?}", self.selection); - self.add_log(self.label.clone()); - self.add_log("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".to_string()); - self.add_log("bbbbbbbbbbbbbbbb".to_string()); - self.add_log("cccccccccccccccc".to_string()); - println!("{:?}", self.log_content.text()); + self.start(self.sender.clone()); Task::none() } Message::IpChanged(ip) => { @@ -95,63 +101,98 @@ impl MainWindow{ self.mysql_config.port = port; Task::none() } - Message::UsernameChanged(username)=>{ + Message::UsernameChanged(username) => { self.mysql_config.username = username; Task::none() } - Message::PasswordChanged(password)=>{ + Message::PasswordChanged(password) => { self.mysql_config.password = password; Task::none() } - Message::DatabaseChanged(database)=>{ + Message::DatabaseChanged(database) => { self.mysql_config.database = database; Task::none() } - Message::WorkOrderChanged(work_order)=>{ + Message::WorkOrderChanged(work_order) => { self.mysql_config.work_order = work_order; Task::none() } - Message::TypeSelected(download_type)=>{ + Message::TypeSelected(download_type) => { self.selection = Some(download_type); Task::none() } - Message::LabelChanged(label)=>{ + Message::LabelChanged(label) => { self.label = label; Task::none() } - Message::OnlineChecked(is_online)=>{ + Message::OnlineChecked(is_online) => { self.is_online = is_online; Task::none() } - Message::AddLog(log)=>{ - for c in log.chars(){ + Message::AddLog(log) => { + for c in log.chars() { self.log_content.perform(text_editor::Action::Edit(Edit::Insert(c))) } self.log_content.perform(text_editor::Action::Edit(Edit::Enter)); let line_size = self.log_content.lines().count(); - self.log_content.perform(Scroll{lines: line_size as i32 }); + self.log_content.perform(Scroll { lines: line_size as i32 }); Task::none() } - Message::LogContentChanged(action)=>{ - if action.is_edit(){ - return Task::none() + Message::Tick => { + for log in logs.lock().unwrap().iter() { + for c in log.chars() { + self.log_content.perform(text_editor::Action::Edit(Edit::Insert(c))) + } + self.log_content.perform(text_editor::Action::Edit(Edit::Enter)); + let line_size = self.log_content.lines().count(); + self.log_content.perform(Scroll { lines: line_size as i32 }); } - self.log_content.perform(action); + logs.lock().unwrap().clear(); + + match self.receiver.try_recv() { + Ok(res) => { + self.update(Message::DownloadEnd(res)); + } + Err(channel::TryRecvError::Empty) => { + } + Err(channel::TryRecvError::Disconnected) => { + println!("Disconnected"); + } + }; Task::none() } - Message::WindowEvent(event) =>{ - println!("{:?}", event); - if let Event::Window(window::Event::CloseRequested) = event { - println!("Request Close"); - return window::get_latest().and_then(window::close) - }; - Task::none() - } - _=>{Task::none()} + Message::LogContentChanged(action) => { + match action{ + Scroll { lines } => { + self.log_content.perform(Scroll { lines }); + Task::none() + } + _=>{ + Task::none() + } + } + } + Message::DownloadEnd(res)=>{ + if res{ + add_log("下载成功 By Ui Thread".to_string()); + }else{ + add_log("下载失败 By Ui Thread".to_string()); + } + Task::none() + } + Message::WindowEvent(event) => { + //println!("{:?}", event); + if let Event::Window(window::Event::CloseRequested) = event { + println!("Request Close"); + return window::get_latest().and_then(window::close); + }; + Task::none() + } + _ => { Task::none() } } } - fn view(&self) -> Element{ + fn view(&self) -> Element { let ip_input = text_input( "IP Address", &self.mysql_config.ip, @@ -162,32 +203,32 @@ impl MainWindow{ ).on_input(Message::PortChanged); let username_input = text_input( "Username", - &self.mysql_config.username + &self.mysql_config.username, ).on_input(Message::UsernameChanged); let password_input = text_input( "Password", - &self.mysql_config.password + &self.mysql_config.password, ).on_input(Message::PasswordChanged); let database_input = text_input( "Database", - &self.mysql_config.database + &self.mysql_config.database, ).on_input(Message::DatabaseChanged); let work_order_input = text_input( "WorkOrder", - &self.mysql_config.work_order + &self.mysql_config.work_order, ).on_input(Message::WorkOrderChanged); let label_input = text_input( "label", - &self.label + &self.label, ).on_input(Message::LabelChanged).on_submit(Message::Start()).width(Length::Fill); let content = column![ row![ip_input, port_input].spacing(5), row![username_input, password_input].spacing(5), row![database_input, work_order_input].spacing(5), row![ - radio("BootLoader", DownloadType::BootLoader,self.selection,Message::TypeSelected), + radio("BootLoader", DownloadType::Bootloader,self.selection,Message::TypeSelected), radio("App", DownloadType::App,self.selection,Message::TypeSelected), - radio("Cal", DownloadType::Cal,self.selection,Message::TypeSelected), + radio("Cal", DownloadType::Rail,self.selection,Message::TypeSelected), checkbox("online", self.is_online).on_toggle(Message::OnlineChecked) ].spacing(10), row![label_input,button("Start").on_press(Message::Start())].spacing(10), @@ -199,6 +240,96 @@ impl MainWindow{ } fn subscription(&self) -> Subscription { - event::listen().map(Message::WindowEvent) + Subscription::batch(vec![ + event::listen().map(Message::WindowEvent), + time::every(time::Duration::from_millis(50)) + .map(|_| Message::Tick) + ]) + } + + fn start(&mut self, sender: Sender) -> (){ + let mes_config = self.mysql_config.clone(); + let label = self.label.clone(); + let download_type: DownloadType = self.selection.unwrap(); + let online = self.is_online.clone(); + std::thread::spawn(move || { + let mut download_wrapper = download_wrapper::DownloadWrapper::new(); + let mut mes_service: MesService; + if online { + add_log("当前为在线模式, 正在连接数据库".to_string()); + mes_service = MesService::new(mes_config.ip.clone(), mes_config.port.clone(), mes_config.username.clone(), mes_config.password.clone(), mes_config.database.clone()); + add_log("连接成功".to_string()); + add_log("正在过站检测".to_string()); + let check_result = mes_service.check_station(mes_config.work_order.clone(), label.clone(), download_type); + if let Err(res) = check_result { + add_log(format!("过站检测失败: {:?}", res)); + sender.send(false).unwrap(); + } else if let Ok(res) = check_result { + if !res { + add_log("过站检测失败".to_string()); + sender.send(false).unwrap(); + } + add_log("过站检测成功".to_string()); + } + } + add_log("正在检查JLink连接".to_string()); + if let Err(e) = download_wrapper.check_jlink() { + add_log("JLink检查失败, 请检查是否安装驱动或连接是否异常".to_string()); + sender.send(false).unwrap(); + } + add_log("JLink检查成功".to_string()); + add_log("正在检查设备连接".to_string()); + if let Err(e) = download_wrapper.check_device() { + add_log("设备检查失败, 请检查设备是否连接".to_string()); + sender.send(false).unwrap(); + } + add_log("设备检查成功".to_string()); + match download_type { + DownloadType::Bootloader =>{ + add_log("正在擦除Flash".to_string()); + if let Err(e) = download_wrapper.erase(){ + add_log("擦除失败".to_string()); + sender.send(false).unwrap(); + } + add_log("擦除成功".to_string()); + add_log("正在下载BootLoader".to_string()); + if let Err(e) = download_wrapper.download(download_type){ + add_log("下载BootLoader失败".to_string()); + sender.send(false).unwrap(); + } + add_log("下载成功".to_string()); + } + DownloadType::App =>{ + add_log("正在下载App".to_string()); + if let Err(e) = download_wrapper.download(download_type){ + add_log("下载App失败".to_string()); + sender.send(false).unwrap(); + } + add_log("下载成功".to_string()); + } + DownloadType::Rail=>{ + add_log("正在下载Rail".to_string()); + if let Err(e) = download_wrapper.download(download_type){ + add_log("下载Rail失败".to_string()); + sender.send(false).unwrap(); + } + add_log("下载成功".to_string()); + } + } + + return if online { + mes_service = MesService::new(mes_config.ip, mes_config.port, mes_config.username, mes_config.password, mes_config.database); + add_log("正在上传数据".to_string()); + let update_result = mes_service.update_station(mes_config.work_order, label, download_type); + if let Err(e) = update_result { + add_log(format!("上传失败: {:?}", e)); + sender.send(false).unwrap(); + } + sender.send(true).unwrap(); + } else { + add_log("当前为离线模式".to_string()); + sender.send(true).unwrap(); + } + }); } } \ No newline at end of file diff --git a/src/mes_service.rs b/src/mes_service.rs index 7cf4505..8985501 100644 --- a/src/mes_service.rs +++ b/src/mes_service.rs @@ -2,12 +2,12 @@ use crate::download_wrapper::DownloadType; use anyhow::Error; use mysql::prelude::*; -struct MesService { +pub(crate) struct MesService { pool: mysql::Pool, } impl MesService { - fn new(ip: String, port: String, username: String, password: String, database: String) -> Self { + pub fn new(ip: String, port: String, username: String, password: String, database: String) -> Self { let url = format!( "mysql://{}:{}@{}:{}/{}", username, password, ip, port, database @@ -16,14 +16,14 @@ impl MesService { Self { pool } } - fn get_work_orders(&self) -> Result, Error> { + pub fn get_work_orders(&self) -> Result, Error> { let mut conn = self.pool.get_conn()?; let work_orders: Vec = conn.query("SELECT `OrderId` FROM wisun_ordertables".to_string())?; Ok(work_orders) } - fn check_station( + pub fn check_station( &self, work_order: String, label: String, @@ -63,7 +63,7 @@ impl MesService { } } - fn update_station(&self, work_order: String, label: String, download_type: DownloadType) -> Result<(), Error> { + pub fn update_station(&self, work_order: String, label: String, download_type: DownloadType) -> Result<(), Error> { match download_type { DownloadType::Bootloader => { let mut conn = self.pool.get_conn()?;