pipeline
This commit is contained in:
parent
7c486cf13a
commit
c5a5c1961e
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -530,6 +530,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"shapefile",
|
||||
"smallvec",
|
||||
"sorted-vec",
|
||||
"surfman",
|
||||
"svg",
|
||||
"thiserror",
|
||||
@ -3503,6 +3504,12 @@ dependencies = [
|
||||
"wayland-protocols",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sorted-vec"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6734caf0b6f51addd5eeacca12fb39b2c6c14e8d4f3ac42f3a78955c0467458"
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
|
||||
@ -82,6 +82,7 @@ regex = "1.10.3"
|
||||
smallvec = "1.13.1"
|
||||
rayon = "1.8.1"
|
||||
futures = "0.3.30"
|
||||
sorted-vec = "0.8.3"
|
||||
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
@ -1 +1 @@
|
||||
{"rustc_fingerprint":8475780184195034948,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/ruomu/.rustup/toolchains/nightly-x86_64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.74.0-nightly (8142a319e 2023-09-13)\nbinary: rustc\ncommit-hash: 8142a319ed5c1d1f96e5a1881a6546e463b77c8f\ncommit-date: 2023-09-13\nhost: x86_64-apple-darwin\nrelease: 1.74.0-nightly\nLLVM version: 17.0.0\n","stderr":""}},"successes":{}}
|
||||
{"rustc_fingerprint":6534886339914138005,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.77.0-nightly (d78329b92 2024-01-13)\nbinary: rustc\ncommit-hash: d78329b92e8d141d19505e7c1527181c4ab87ed4\ncommit-date: 2024-01-13\nhost: aarch64-apple-darwin\nrelease: 1.77.0-nightly\nLLVM version: 17.0.6\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/tsuki/.rustup/toolchains/nightly-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"v8.1a\"\ntarget_feature=\"v8.2a\"\ntarget_feature=\"v8.3a\"\ntarget_feature=\"v8.4a\"\ntarget_feature=\"vh\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}}
|
||||
@ -1 +1 @@
|
||||
747a3e56d0023d1f
|
||||
16f3840281ed1c0f
|
||||
@ -1 +1 @@
|
||||
{"rustc":2034204546556879275,"features":"[]","target":8454914719411586997,"profile":3567329628440936607,"path":17523903030608720598,"deps":[[3470807962260834726,"serde",false,4787662401497216020],[6147374319788932929,"serde_json",false,13625016085015906423],[6644485573429891122,"thiserror",false,1778660508903088478],[6954241390595330609,"nom",false,2941494162337318825],[8926101378076943148,"byteorder",false,13786993926510157100],[8944703748776155531,"chrono",false,9456401766367467294],[10043922549268360936,"radarg_plugin_interface",false,11802334733291555594],[11138931377059941435,"num_traits",false,2532219253751132008],[12701726091060201577,"abi_stable",false,2027217686562626457],[12732307821348191974,"anyhow",false,10525944046939466143],[12935855096716563853,"flate2",false,6751665531550146114],[16098302879908240583,"nom_derive",false,13622616610426096756]],"local":[{"CheckDepInfo":{"dep_info":"release/.fingerprint/etws_loader-826e392dbec97b5d/dep-lib-etws_loader"}}],"rustflags":[],"metadata":41698518999418921,"config":2202906307356721367,"compile_kind":0}
|
||||
{"rustc":17942353898403517573,"features":"[]","declared_features":"","target":8454914719411586997,"profile":14094339167972473758,"path":17523903030608720598,"deps":[[3470807962260834726,"serde",false,3464438898850424389],[6147374319788932929,"serde_json",false,4018346002534341099],[6644485573429891122,"thiserror",false,15376366722783231122],[6954241390595330609,"nom",false,17004332135801955629],[8926101378076943148,"byteorder",false,6029042559770906212],[8944703748776155531,"chrono",false,14085117952510397354],[10043922549268360936,"radarg_plugin_interface",false,2929903515477199145],[11138931377059941435,"num_traits",false,16208028648554347177],[12701726091060201577,"abi_stable",false,46919867052192855],[12732307821348191974,"anyhow",false,13132421988549874417],[12935855096716563853,"flate2",false,9880693184163145737],[16098302879908240583,"nom_derive",false,9783335926581460414]],"local":[{"CheckDepInfo":{"dep_info":"release/.fingerprint/etws_loader-826e392dbec97b5d/dep-lib-etws_loader"}}],"rustflags":[],"metadata":41698518999418921,"config":2202906307356721367,"compile_kind":0}
|
||||
@ -1,7 +1,7 @@
|
||||
{"message":"unused imports: `Write`, `self`","code":{"code":"unused_imports","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":323,"byte_end":327,"line_start":13,"line_end":13,"column_start":15,"column_end":19,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":15,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":335,"byte_end":340,"line_start":13,"line_end":13,"column_start":27,"column_end":32,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":27,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_imports)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove the unused imports","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":323,"byte_end":329,"line_start":13,"line_end":13,"column_start":15,"column_end":21,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":15,"highlight_end":21}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"src/parser.rs","byte_start":333,"byte_end":340,"line_start":13,"line_end":13,"column_start":25,"column_end":32,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":25,"highlight_end":32}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused imports: `Write`, `self`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:13:15\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m13\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0muse std::io::{self, Read, Write};\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_imports)]` on by default\u001b[0m\n\n"}
|
||||
{"message":"unused import: `RNone`","code":{"code":"unused_imports","explanation":null},"level":"warning","spans":[{"file_name":"src/lib.rs","byte_start":180,"byte_end":185,"line_start":9,"line_end":9,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" RNone, ROk,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove the unused import","code":null,"level":"help","spans":[{"file_name":"src/lib.rs","byte_start":180,"byte_end":187,"line_start":9,"line_end":9,"column_start":9,"column_end":16,"is_primary":true,"text":[{"text":" RNone, ROk,","highlight_start":9,"highlight_end":16}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused import: `RNone`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:9:9\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m9\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m RNone, ROk,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\n\n"}
|
||||
{"message":"unused variable: `hlen2`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":4573,"byte_end":4578,"line_start":153,"line_end":153,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":" let (input, hlen2) = Self::_parse_u32(input, order)?;","highlight_start":21,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_variables)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":4573,"byte_end":4578,"line_start":153,"line_end":153,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":" let (input, hlen2) = Self::_parse_u32(input, order)?;","highlight_start":21,"highlight_end":26}],"label":null,"suggested_replacement":"_hlen2","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `hlen2`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:153:21\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m153\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let (input, hlen2) = Self::_parse_u32(input, order)?;\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_hlen2`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_variables)]` on by default\u001b[0m\n\n"}
|
||||
{"message":"unused variable: `order`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":6566,"byte_end":6571,"line_start":221,"line_end":221,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" order: Order,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":6566,"byte_end":6571,"line_start":221,"line_end":221,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" order: Order,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":"_order","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `order`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:221:9\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m221\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m order: Order,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_order`\u001b[0m\n\n"}
|
||||
{"message":"unused variable: `dimension_len`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/lib.rs","byte_start":1019,"byte_end":1032,"line_start":41,"line_end":41,"column_start":26,"column_end":39,"is_primary":true,"text":[{"text":" let (dimension_len, data) = match b.data {","highlight_start":26,"highlight_end":39}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/lib.rs","byte_start":1019,"byte_end":1032,"line_start":41,"line_end":41,"column_start":26,"column_end":39,"is_primary":true,"text":[{"text":" let (dimension_len, data) = match b.data {","highlight_start":26,"highlight_end":39}],"label":null,"suggested_replacement":"_dimension_len","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `dimension_len`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:41:26\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m41\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let (dimension_len, data) = match b.data {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_dimension_len`\u001b[0m\n\n"}
|
||||
{"message":"variants `I64` and `U64` are never constructed","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":544,"byte_end":554,"line_start":27,"line_end":27,"column_start":6,"column_end":16,"is_primary":false,"text":[{"text":"enum ValueTypes {","highlight_start":6,"highlight_end":16}],"label":"variants in this enum","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":561,"byte_end":564,"line_start":28,"line_end":28,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" I64,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":597,"byte_end":600,"line_start":32,"line_end":32,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" U64,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(dead_code)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: variants `I64` and `U64` are never constructed\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:28:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m27\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0menum ValueTypes {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m----------\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12mvariants in this enum\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m28\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m I64,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m...\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m32\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m U64,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(dead_code)]` on by default\u001b[0m\n\n"}
|
||||
{"message":"6 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 6 warnings emitted\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"unused imports: `Write`, `self`","code":{"code":"unused_imports","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":323,"byte_end":327,"line_start":13,"line_end":13,"column_start":15,"column_end":19,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":15,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":335,"byte_end":340,"line_start":13,"line_end":13,"column_start":27,"column_end":32,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":27,"highlight_end":32}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_imports)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"remove the unused imports","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":323,"byte_end":329,"line_start":13,"line_end":13,"column_start":15,"column_end":21,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":15,"highlight_end":21}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"src/parser.rs","byte_start":333,"byte_end":340,"line_start":13,"line_end":13,"column_start":25,"column_end":32,"is_primary":true,"text":[{"text":"use std::io::{self, Read, Write};","highlight_start":25,"highlight_end":32}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused imports: `Write`, `self`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:13:15\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m13\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0muse std::io::{self, Read, Write};\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_imports)]` on by default\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"unused import: `RNone`","code":{"code":"unused_imports","explanation":null},"level":"warning","spans":[{"file_name":"src/lib.rs","byte_start":180,"byte_end":185,"line_start":9,"line_end":9,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" RNone, ROk,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove the unused import","code":null,"level":"help","spans":[{"file_name":"src/lib.rs","byte_start":180,"byte_end":187,"line_start":9,"line_end":9,"column_start":9,"column_end":16,"is_primary":true,"text":[{"text":" RNone, ROk,","highlight_start":9,"highlight_end":16}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused import: `RNone`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:9:9\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m9\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m RNone, ROk,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"unused variable: `hlen2`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":4573,"byte_end":4578,"line_start":153,"line_end":153,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":" let (input, hlen2) = Self::_parse_u32(input, order)?;","highlight_start":21,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(unused_variables)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":4573,"byte_end":4578,"line_start":153,"line_end":153,"column_start":21,"column_end":26,"is_primary":true,"text":[{"text":" let (input, hlen2) = Self::_parse_u32(input, order)?;","highlight_start":21,"highlight_end":26}],"label":null,"suggested_replacement":"_hlen2","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `hlen2`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:153:21\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m153\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let (input, hlen2) = Self::_parse_u32(input, order)?;\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_hlen2`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(unused_variables)]` on by default\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"unused variable: `order`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":6566,"byte_end":6571,"line_start":221,"line_end":221,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" order: Order,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/parser.rs","byte_start":6566,"byte_end":6571,"line_start":221,"line_end":221,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" order: Order,","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":"_order","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `order`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:221:9\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m221\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m order: Order,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_order`\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"unused variable: `dimension_len`","code":{"code":"unused_variables","explanation":null},"level":"warning","spans":[{"file_name":"src/lib.rs","byte_start":1019,"byte_end":1032,"line_start":41,"line_end":41,"column_start":26,"column_end":39,"is_primary":true,"text":[{"text":" let (dimension_len, data) = match b.data {","highlight_start":26,"highlight_end":39}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"if this is intentional, prefix it with an underscore","code":null,"level":"help","spans":[{"file_name":"src/lib.rs","byte_start":1019,"byte_end":1032,"line_start":41,"line_end":41,"column_start":26,"column_end":39,"is_primary":true,"text":[{"text":" let (dimension_len, data) = match b.data {","highlight_start":26,"highlight_end":39}],"label":null,"suggested_replacement":"_dimension_len","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: unused variable: `dimension_len`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:41:26\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m41\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let (dimension_len, data) = match b.data {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_dimension_len`\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"variants `I64` and `U64` are never constructed","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/parser.rs","byte_start":544,"byte_end":554,"line_start":27,"line_end":27,"column_start":6,"column_end":16,"is_primary":false,"text":[{"text":"enum ValueTypes {","highlight_start":6,"highlight_end":16}],"label":"variants in this enum","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":561,"byte_end":564,"line_start":28,"line_end":28,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" I64,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/parser.rs","byte_start":597,"byte_end":600,"line_start":32,"line_end":32,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" U64,","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(dead_code)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: variants `I64` and `U64` are never constructed\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/parser.rs:28:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m27\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0menum ValueTypes {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m----------\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12mvariants in this enum\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m28\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m I64,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m...\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m32\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m U64,\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(dead_code)]` on by default\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"6 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 6 warnings emitted\u001b[0m\n\n"}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/Users/ruomu/projects/cinrad_g/etws_loader/target/release/deps/libetws_loader.dylib: src/lib.rs src/error.rs src/parser.rs
|
||||
/Users/tsuki/projects/radar-g/etws_loader/target/release/deps/libetws_loader.dylib: src/lib.rs src/error.rs src/parser.rs
|
||||
|
||||
/Users/ruomu/projects/cinrad_g/etws_loader/target/release/deps/libetws_loader.rlib: src/lib.rs src/error.rs src/parser.rs
|
||||
/Users/tsuki/projects/radar-g/etws_loader/target/release/deps/libetws_loader.rlib: src/lib.rs src/error.rs src/parser.rs
|
||||
|
||||
/Users/ruomu/projects/cinrad_g/etws_loader/target/release/deps/etws_loader.d: src/lib.rs src/error.rs src/parser.rs
|
||||
/Users/tsuki/projects/radar-g/etws_loader/target/release/deps/etws_loader.d: src/lib.rs src/error.rs src/parser.rs
|
||||
|
||||
src/lib.rs:
|
||||
src/error.rs:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
/Users/ruomu/projects/cinrad_g/etws_loader/target/release/libetws_loader.dylib: /Users/ruomu/projects/cinrad_g/etws_loader/src/error.rs /Users/ruomu/projects/cinrad_g/etws_loader/src/lib.rs /Users/ruomu/projects/cinrad_g/etws_loader/src/parser.rs /Users/ruomu/projects/cinrad_g/radarg_plugin_interface/src/error.rs /Users/ruomu/projects/cinrad_g/radarg_plugin_interface/src/lib.rs
|
||||
/Users/tsuki/projects/radar-g/etws_loader/target/release/libetws_loader.dylib: /Users/tsuki/projects/radar-g/etws_loader/src/error.rs /Users/tsuki/projects/radar-g/etws_loader/src/lib.rs /Users/tsuki/projects/radar-g/etws_loader/src/parser.rs /Users/tsuki/projects/radar-g/radarg_plugin_interface/src/error.rs /Users/tsuki/projects/radar-g/radarg_plugin_interface/src/lib.rs
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -5,7 +5,6 @@ use crate::{
|
||||
pipeline::{
|
||||
self,
|
||||
offscreen_renderer::OffscreenRenderer,
|
||||
pool::Pool,
|
||||
render_pipeline::RenderResult,
|
||||
utils::{Dispatcher, Pipeline},
|
||||
},
|
||||
@ -17,7 +16,10 @@ use crate::{
|
||||
PLUGIN_MANAGER,
|
||||
};
|
||||
use std::{
|
||||
borrow::{Borrow, BorrowMut},
|
||||
cell::RefCell,
|
||||
collections::HashMap,
|
||||
rc::Rc,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
@ -44,6 +46,8 @@ use relm4_components::open_dialog::{
|
||||
OpenDialog, OpenDialogMsg, OpenDialogResponse, OpenDialogSettings,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
use sorted_vec::SortedSet;
|
||||
use tokio::{sync::oneshot, task};
|
||||
|
||||
relm4::new_action_group!(FileActionGroup, "file");
|
||||
relm4::new_stateless_action!(OpenAction, FileActionGroup, "open");
|
||||
@ -60,7 +64,7 @@ pub enum AppMsg {
|
||||
|
||||
pub struct AppModel {
|
||||
dispatcher: Arc<Mutex<Dispatcher>>,
|
||||
buffer: SmallVec<[RenderResult; 20]>,
|
||||
buffer: Rc<RefCell<HashMap<String, Vec<(DateTime<Utc>, Option<RenderResult>)>>>>,
|
||||
open_dialog: Controller<OpenDialog>,
|
||||
control: Controller<ControlPanelModel>,
|
||||
target_pipeline: HashMap<String, Pipeline>,
|
||||
@ -71,6 +75,7 @@ pub struct AppModel {
|
||||
#[derive(Debug)]
|
||||
pub enum AppCommand {
|
||||
PrepareFinished(Vec<Result<RenderResult, RenderError>>),
|
||||
TestBuffer((String, RenderResult)),
|
||||
Test,
|
||||
}
|
||||
|
||||
@ -173,8 +178,8 @@ impl Component for AppModel {
|
||||
let app = relm4::main_application();
|
||||
relm4_icons::initialize_icons();
|
||||
|
||||
let mut dispatcher = Dispatcher::new(5, 5, chrono::Duration::minutes(1));
|
||||
|
||||
let buffer = Rc::new(RefCell::new(HashMap::new()));
|
||||
let mut dispatcher = Dispatcher::new(5, 5, chrono::Duration::minutes(1), buffer.clone());
|
||||
let mut path_format = HashMap::new();
|
||||
|
||||
path_format.insert(
|
||||
@ -184,7 +189,8 @@ impl Component for AppModel {
|
||||
dispatcher.set_path_format(path_format);
|
||||
|
||||
let model = AppModel {
|
||||
buffer: SmallVec::new(),
|
||||
// time_buffer: HashMap::new(),
|
||||
buffer: buffer,
|
||||
dispatcher: Arc::new(Mutex::new(dispatcher)),
|
||||
open_dialog: dialog,
|
||||
target_pipeline: HashMap::new(),
|
||||
@ -239,24 +245,14 @@ impl Component for AppModel {
|
||||
fn update(&mut self, msg: Self::Input, _sender: ComponentSender<Self>, root: &Self::Root) {
|
||||
match msg {
|
||||
AppMsg::OpenFile((time, layer)) => {
|
||||
if !self.target_pipeline.contains_key(&layer.name) {
|
||||
let mut pipeline = Pipeline::new(10, layer.name.clone());
|
||||
pipeline.set_dispatcher(self.dispatcher.clone());
|
||||
self.target_pipeline.insert(layer.name.clone(), pipeline);
|
||||
}
|
||||
let pipeline = {
|
||||
let pipeline = self.target_pipeline.get_mut(&layer.name).unwrap();
|
||||
pipeline.set_current(time, true);
|
||||
pipeline
|
||||
};
|
||||
let worker = Pipeline::run(pipeline);
|
||||
let layer_name = layer.name.clone();
|
||||
|
||||
let listening = pipeline.listening();
|
||||
_sender.oneshot_command(async move {
|
||||
let results = worker.await;
|
||||
listening.await;
|
||||
AppCommand::Test
|
||||
});
|
||||
// Init Pipeline and buffer by key
|
||||
let pipeline = self.create_pipeline(layer_name.as_ref());
|
||||
let buffer = self.create_buffer(layer_name.clone());
|
||||
let tasks = self.create_tasks(layer_name, time);
|
||||
|
||||
// Monitor Render Result first and Set the timeline widget's info
|
||||
self.render.sender().emit(MonitorInputMsg::AddLayer(layer));
|
||||
self.control
|
||||
.sender()
|
||||
@ -266,6 +262,63 @@ impl Component for AppModel {
|
||||
.emit(ControlPanelInputMsg::TimeLine(TimelineMsg::SetStart(
|
||||
time - Duration::minutes(30),
|
||||
)));
|
||||
|
||||
// Start New Pipeline
|
||||
let worker = Pipeline::run(pipeline);
|
||||
let new_sender = _sender.clone();
|
||||
|
||||
// Listen to the result, if the result is ok, send it to the buffer
|
||||
let mut thumb_senders: Vec<oneshot::Sender<gtk::gdk::Texture>> = Vec::new();
|
||||
let mut thumb_recivers = Vec::new();
|
||||
let mut current_buffer = (*self.buffer).borrow_mut();
|
||||
let mut current_buffer = current_buffer.get_mut(layer_name.as_str()).unwrap();
|
||||
|
||||
for _ in 0..num {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
thumb_recivers.push(rx);
|
||||
thumb_senders.push(tx);
|
||||
}
|
||||
|
||||
self.control.emit(ControlPanelInputMsg::SetThumb(
|
||||
thumb_recivers
|
||||
.into_iter()
|
||||
.map(|p| (None, Some(p), time))
|
||||
.collect(),
|
||||
));
|
||||
|
||||
let mut p = Vec::new();
|
||||
for sender in thumb_senders {
|
||||
let new_sender = _sender.clone();
|
||||
let f = move |tx: oneshot::Receiver<Result<RenderResult, RenderError>>| {
|
||||
Box::pin(async move {
|
||||
if let Ok(r) = tx.await {
|
||||
let r = r.unwrap();
|
||||
let tex = (&r)
|
||||
.layer
|
||||
.render_target()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.thumbnail
|
||||
.clone();
|
||||
sender.send(tex.unwrap()).unwrap();
|
||||
new_sender
|
||||
.command_sender()
|
||||
.emit(AppCommand::TestBuffer((format!("DBZ"), r)));
|
||||
}
|
||||
}) as BoxFuture<'static, ()>
|
||||
};
|
||||
p.push(f);
|
||||
}
|
||||
|
||||
let listening = pipeline.listening_one_by_one(p);
|
||||
// Spawn the worker and listen to the result
|
||||
new_sender.oneshot_command(async move {
|
||||
task::spawn(worker);
|
||||
listening.await;
|
||||
AppCommand::Test
|
||||
});
|
||||
}
|
||||
AppMsg::CloseRequest => {}
|
||||
AppMsg::Close => {}
|
||||
@ -274,21 +327,27 @@ impl Component for AppModel {
|
||||
}
|
||||
AppMsg::CheckTo((key, datetime)) => {
|
||||
use std::iter::Iterator;
|
||||
println!("check to: {}", datetime);
|
||||
let layer = self
|
||||
.buffer
|
||||
.iter()
|
||||
.position(|r: &RenderResult| r.time() == datetime);
|
||||
print!("layer: {:?}\n", layer);
|
||||
for r in self.buffer.iter() {
|
||||
print!("{} ", r.time());
|
||||
println!("CheckTo");
|
||||
let buffer = (*self.buffer).borrow();
|
||||
if let Some(t) = buffer.get(key.as_str()) {
|
||||
let current_pipeline = self.target_pipeline.get_mut(key.as_str()).unwrap();
|
||||
current_pipeline.set_current(datetime, true);
|
||||
let worker = Pipeline::run(current_pipeline);
|
||||
|
||||
if let Some(p) = t.iter().position(|(dt, t)| *dt == datetime) {
|
||||
let (_, rs) = t.get(p).unwrap();
|
||||
if let None = rs.as_ref() {
|
||||
//TODO: Add a spinner
|
||||
} else {
|
||||
let r = rs.as_ref().unwrap();
|
||||
self.render.emit(MonitorInputMsg::RemoveLayer(0));
|
||||
self.render.emit(MonitorInputMsg::AddLayer(r.layer.clone()));
|
||||
}
|
||||
if let Some(layer) = layer {
|
||||
let layer = self.buffer.get(layer).unwrap().clone();
|
||||
self.render.sender().emit(MonitorInputMsg::RemoveLayer(0));
|
||||
self.render
|
||||
.sender()
|
||||
.emit(MonitorInputMsg::AddLayer(layer.layer));
|
||||
} else {
|
||||
panic!("Pipeline error");
|
||||
}
|
||||
} else {
|
||||
panic!("Pipeline error");
|
||||
}
|
||||
}
|
||||
AppMsg::OpenDialogMulti => {}
|
||||
@ -303,44 +362,58 @@ impl Component for AppModel {
|
||||
root: &Self::Root,
|
||||
) {
|
||||
match message {
|
||||
AppCommand::PrepareFinished(mut v) => {
|
||||
let sorted = v.sort_by_key(|r| {
|
||||
if let Ok(result) = r.as_ref() {
|
||||
result.timestamp()
|
||||
} else {
|
||||
0
|
||||
AppCommand::PrepareFinished(mut v) => {}
|
||||
AppCommand::TestBuffer((key, result)) => {
|
||||
let datetime = result.time();
|
||||
let mut buffer = (*self.buffer).borrow_mut();
|
||||
let mut buffer = buffer.get_mut(key.as_str()).unwrap();
|
||||
let _position = buffer
|
||||
.iter_mut()
|
||||
.position(|(t, r)| *t == result.time())
|
||||
.unwrap();
|
||||
buffer[_position].1 = Some(result);
|
||||
}
|
||||
});
|
||||
let v = v.into_iter().filter(|p| p.is_ok()).map(|p| p.unwrap());
|
||||
self.buffer.extend(v);
|
||||
println!("buffer size: {}", self.buffer.len());
|
||||
_ => {
|
||||
println!("test");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let thumbs = self
|
||||
.buffer
|
||||
.iter()
|
||||
.map(|r| {
|
||||
let datetime = r.time();
|
||||
let layer = r.layer.clone();
|
||||
|
||||
let c = {
|
||||
let layer = layer.render_target();
|
||||
let target = layer.lock().unwrap();
|
||||
let c = target.as_ref().map(|p| p.thumbnail.clone()).flatten();
|
||||
c
|
||||
};
|
||||
|
||||
(c, datetime)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for i in self.buffer.iter() {
|
||||
println!("{} ", i.time());
|
||||
impl AppModel {
|
||||
fn create_buffer(
|
||||
&mut self,
|
||||
key: impl Borrow<str>,
|
||||
) -> &mut Vec<(DateTime<Utc>, Option<RenderResult>)> {
|
||||
if !(*self.buffer).borrow().contains_key(key.borrow()) {
|
||||
(*self.buffer)
|
||||
.borrow_mut()
|
||||
.insert(key.borrow().to_string(), Vec::new());
|
||||
}
|
||||
|
||||
self.control.emit(ControlPanelInputMsg::SetThumb(thumbs))
|
||||
&mut (*(*self.buffer).borrow_mut().get_mut(key.borrow()).unwrap())
|
||||
}
|
||||
_ => {}
|
||||
|
||||
fn create_pipeline(&mut self, key: impl Borrow<str>) -> &mut Pipeline {
|
||||
if !self.target_pipeline.contains_key(key.borrow()) {
|
||||
let mut pipeline = Pipeline::new(10, key.borrow().to_string());
|
||||
pipeline.init().set_dispatcher(self.dispatcher.clone());
|
||||
self.target_pipeline
|
||||
.insert(key.borrow().to_string(), pipeline);
|
||||
}
|
||||
self.target_pipeline.get_mut(key.borrow()).unwrap()
|
||||
}
|
||||
|
||||
fn create_tasks(
|
||||
&mut self,
|
||||
key: impl AsRef<str>,
|
||||
time: DateTime<Utc>,
|
||||
) -> Option<Vec<(DateTime<Utc>, Option<RenderResult>)>> {
|
||||
let pipeline = self.target_pipeline.get_mut(key.as_ref()).unwrap();
|
||||
let time_list = pipeline.set_current(time, true);
|
||||
let mut buffer = (*self.buffer).borrow_mut();
|
||||
let mut buffer = buffer.get_mut(key.as_ref()).unwrap();
|
||||
time_list.map(|time_list| time_list.into_iter().map(|t| (t, None)).collect())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
use super::messages::*;
|
||||
use super::thumbnail::{ImgItem, TypedListView};
|
||||
use crate::data::{CoordType, Radar2d, RadarData2d};
|
||||
use crate::plugin_system::init_plugin;
|
||||
use crate::widgets::render::predefined::color_mapper::BoundaryNorm;
|
||||
@ -11,8 +12,7 @@ use gtk::glib::clone;
|
||||
use gtk::prelude::{BoxExt, ButtonExt, GtkWindowExt, OrientableExt, ToggleButtonExt};
|
||||
use ndarray::{Array1, Array2, Array3};
|
||||
use radarg_plugin_interface::VecResult;
|
||||
use relm4::typed_list_view::{RelmListItem, TypedListView};
|
||||
use relm4::*;
|
||||
use relm4::prelude::*;
|
||||
use relm4_components::open_button::{OpenButton, OpenButtonSettings};
|
||||
use relm4_components::open_dialog::OpenDialogSettings;
|
||||
use std::path::PathBuf;
|
||||
@ -205,8 +205,7 @@ impl SimpleComponent for ControlPanelModel {
|
||||
let step_selector = gtk::DropDown::from_strings(&["Option 1", "Option 2", "Option 3"]);
|
||||
|
||||
let mut list_img_wrapper: TypedListView<ImgItem, gtk::SingleSelection> =
|
||||
TypedListView::with_sorting();
|
||||
list_img_wrapper.append(ImgItem::new("00:00:00".to_string(), None, true));
|
||||
TypedListView::new();
|
||||
|
||||
let timeline_start = Utc::now();
|
||||
let model = ControlPanelModel {
|
||||
@ -258,62 +257,13 @@ impl SimpleComponent for ControlPanelModel {
|
||||
}
|
||||
|
||||
ControlPanelInputMsg::SetThumb(v) => {
|
||||
for (texture, t) in v {
|
||||
self.list_img_wrapper.append(ImgItem {
|
||||
time: t.to_string(),
|
||||
img: texture,
|
||||
visiable: true,
|
||||
});
|
||||
for (texture, rx, t) in v {
|
||||
self.list_img_wrapper
|
||||
.append(ImgItem::new(t.to_string(), texture, true, rx));
|
||||
}
|
||||
}
|
||||
|
||||
ControlPanelInputMsg::SetThumbByDate((time, thumb)) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, PartialOrd, Ord, Eq)]
|
||||
struct ImgItem {
|
||||
time: String,
|
||||
img: Option<gtk::gdk::Texture>,
|
||||
visiable: bool,
|
||||
}
|
||||
|
||||
impl ImgItem {
|
||||
fn new(time: String, img: Option<gtk::gdk::Texture>, visiable: bool) -> Self {
|
||||
Self {
|
||||
time,
|
||||
img,
|
||||
visiable,
|
||||
}
|
||||
}
|
||||
}
|
||||
struct Widgets {
|
||||
img: gtk::Image,
|
||||
}
|
||||
|
||||
impl RelmListItem for ImgItem {
|
||||
type Root = gtk::Frame;
|
||||
type Widgets = Widgets;
|
||||
|
||||
fn setup(_item: >k::ListItem) -> (gtk::Frame, Widgets) {
|
||||
relm4::view! {
|
||||
my_box = gtk::Frame {
|
||||
set_height_request: 70,
|
||||
set_width_request: 100,
|
||||
gtk::Box{
|
||||
set_margin_all:2,
|
||||
set_hexpand:true,
|
||||
set_vexpand:true,
|
||||
#[name = "img"]
|
||||
gtk::Image{}
|
||||
}
|
||||
}
|
||||
}
|
||||
let widgets = Widgets { img };
|
||||
(my_box, widgets)
|
||||
}
|
||||
|
||||
fn bind(&mut self, widgets: &mut Self::Widgets, _root: &mut Self::Root) {
|
||||
let Widgets { img } = widgets;
|
||||
img.set_paintable(self.img.as_ref());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum TimelineMsg {
|
||||
@ -11,7 +12,14 @@ pub enum TimelineMsg {
|
||||
pub enum ControlPanelInputMsg {
|
||||
TimeLine(TimelineMsg),
|
||||
Selection(Option<DateTime<Utc>>),
|
||||
SetThumb(Vec<(Option<gtk::gdk::Texture>, DateTime<Utc>)>),
|
||||
SetThumb(
|
||||
Vec<(
|
||||
Option<gtk::gdk::Texture>,
|
||||
Option<oneshot::Receiver<gtk::gdk::Texture>>,
|
||||
DateTime<Utc>,
|
||||
)>,
|
||||
),
|
||||
SetThumbByDate((DateTime<Utc>, Option<gtk::gdk::Texture>)),
|
||||
SelectionRewind,
|
||||
SelectionFastForward,
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
mod control_panel;
|
||||
mod messages;
|
||||
mod thumbnail;
|
||||
pub use control_panel::*;
|
||||
pub use messages::*;
|
||||
|
||||
74
src/components/control_panel/thumbnail.rs
Normal file
74
src/components/control_panel/thumbnail.rs
Normal file
@ -0,0 +1,74 @@
|
||||
use gtk::prelude::*;
|
||||
pub use relm4::typed_list_view::{RelmListItem, TypedListView};
|
||||
use relm4::RelmWidgetExt;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(super) struct ImgItem {
|
||||
pub(super) time: String,
|
||||
pub(super) img: Arc<Mutex<Option<gtk::gdk::Texture>>>,
|
||||
pub(super) visiable: bool,
|
||||
pub(super) rx: Option<oneshot::Receiver<gtk::gdk::Texture>>,
|
||||
handle: Option<gtk::glib::JoinHandle<()>>,
|
||||
}
|
||||
|
||||
impl ImgItem {
|
||||
pub(super) fn new(
|
||||
time: String,
|
||||
img: Option<gtk::gdk::Texture>,
|
||||
visiable: bool,
|
||||
rx: Option<oneshot::Receiver<gtk::gdk::Texture>>,
|
||||
) -> Self {
|
||||
assert!(rx.is_none() && img.is_some() || rx.is_some() && img.is_none());
|
||||
Self {
|
||||
time,
|
||||
img: Arc::new(Mutex::new(img)),
|
||||
visiable,
|
||||
rx,
|
||||
handle: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub(super) struct Widgets {
|
||||
img: gtk::Image,
|
||||
}
|
||||
|
||||
impl RelmListItem for ImgItem {
|
||||
type Root = gtk::Frame;
|
||||
type Widgets = Widgets;
|
||||
|
||||
fn setup(_item: >k::ListItem) -> (gtk::Frame, Widgets) {
|
||||
relm4::view! {
|
||||
my_box = gtk::Frame {
|
||||
set_height_request: 70,
|
||||
set_width_request: 100,
|
||||
gtk::Box{
|
||||
set_margin_all:2,
|
||||
set_hexpand:true,
|
||||
set_vexpand:true,
|
||||
#[name = "img"]
|
||||
gtk::Image{}
|
||||
}
|
||||
}
|
||||
}
|
||||
let widgets = Widgets { img };
|
||||
(my_box, widgets)
|
||||
}
|
||||
|
||||
fn bind(&mut self, widgets: &mut Self::Widgets, _root: &mut Self::Root) {
|
||||
let Widgets { img } = widgets;
|
||||
if self.rx.is_some() {
|
||||
let new_rx = self.rx.take().unwrap();
|
||||
let ltex = self.img.clone();
|
||||
let new_img = img.clone();
|
||||
self.handle = Some(relm4::spawn_local(async move {
|
||||
let tex = new_rx.await.unwrap();
|
||||
ltex.lock().unwrap().replace(tex);
|
||||
new_img.set_paintable(ltex.lock().unwrap().as_ref());
|
||||
}));
|
||||
}
|
||||
let ltex = self.img.lock().unwrap();
|
||||
img.set_paintable(ltex.as_ref());
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
pub mod messages;
|
||||
pub mod monitor;
|
||||
pub mod sidebar;
|
||||
pub mod messages;
|
||||
pub use monitor::MonitorModel;
|
||||
|
||||
@ -17,7 +17,7 @@ pub trait Coord<T: Num> {
|
||||
fn dim2_range(&self) -> (T, T);
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
|
||||
pub struct Range(pub f64, pub f64);
|
||||
|
||||
impl Range {
|
||||
|
||||
168
src/pipeline/pool copy.rs
Normal file
168
src/pipeline/pool copy.rs
Normal file
@ -0,0 +1,168 @@
|
||||
use crate::errors::PoolError;
|
||||
use smallvec::SmallVec;
|
||||
use sorted_vec::SortedSet;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
type PResult<T> = Result<T, PoolError>;
|
||||
|
||||
pub struct Pool<T>
|
||||
where
|
||||
T: Send + Sync + Ord,
|
||||
{
|
||||
items: SortedSet<T>,
|
||||
current: Option<(i64, usize)>,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
impl<T> Pool<T>
|
||||
where
|
||||
T: Send + Sync + Ord,
|
||||
{
|
||||
pub fn new(len: usize) -> Self {
|
||||
Pool {
|
||||
items: VecDeque::new(),
|
||||
current: None,
|
||||
len,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init(&mut self, timestamp: i64, item: T) -> PResult<()> {
|
||||
let len = self.items.len();
|
||||
|
||||
if len == 0 {
|
||||
self.items.push_back((timestamp, item));
|
||||
self.current.replace((timestamp, 0));
|
||||
return Ok(());
|
||||
} else {
|
||||
return Err(PoolError::PoolInitialized("Pool is already initialized"));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add(&mut self, item: T, timestamp: i64) -> PResult<()> {
|
||||
let len = self.items.len();
|
||||
if len == self.len {
|
||||
return Err(PoolError::PoolFull);
|
||||
}
|
||||
if len == 0 {
|
||||
return Err(PoolError::PoolInitialized("Pool is not initialized"));
|
||||
}
|
||||
if len == 1 {
|
||||
if self.items[0].0 < timestamp {
|
||||
self.items.push_back((timestamp, item));
|
||||
} else {
|
||||
self.items.push_front((timestamp, item));
|
||||
self.current.replace((timestamp, 1));
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let back = self
|
||||
.items
|
||||
.back()
|
||||
.map(|(last_timestamp, _)| *last_timestamp < timestamp)
|
||||
.unwrap();
|
||||
let front = self
|
||||
.items
|
||||
.front()
|
||||
.map(|(first_timestamp, _)| *first_timestamp > timestamp)
|
||||
.unwrap();
|
||||
|
||||
if !(back || front) {
|
||||
return Err(PoolError::TimestampError);
|
||||
}
|
||||
|
||||
if back {
|
||||
self.items.push_back((timestamp, item));
|
||||
} else {
|
||||
self.items.push_front((timestamp, item));
|
||||
self.current.as_mut().map(|(_, index)| *index += 1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn prev(&self) -> Option<&T> {
|
||||
self.current
|
||||
.map(|(_, index)| &self.items[index])
|
||||
.map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn next(&mut self) -> Option<&T> {
|
||||
let len = self.items.len();
|
||||
let current = self.current.as_mut().map(|(_, index)| index);
|
||||
|
||||
if let Some(index) = current {
|
||||
if *index + 1 < len {
|
||||
*index += 1;
|
||||
self.current
|
||||
.as_ref()
|
||||
.map(|(_, index)| &self.items[*index])
|
||||
.map(|(_, item)| item)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&self, index: isize) -> Option<&T> {
|
||||
self.current
|
||||
.as_ref()
|
||||
.map(|(_, current_index)| *current_index as isize + index)
|
||||
.and_then(|index| {
|
||||
if index >= 0 && index < self.items.len() as isize {
|
||||
Some(&self.items[index as usize])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self, index: isize) -> Option<&mut T> {
|
||||
self.current
|
||||
.as_ref()
|
||||
.map(|(_, current_index)| *current_index as isize + index)
|
||||
.and_then(|index| {
|
||||
if index >= 0 && index < self.items.len() as isize {
|
||||
Some(&mut self.items[index as usize])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = &T> {
|
||||
self.items.iter().map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T> {
|
||||
self.items.iter_mut().map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn set_current(&mut self, timestamp: i64, item: T) -> PResult<()> {
|
||||
if self.items.len() == 0 {
|
||||
return Err(PoolError::PoolInitialized("Pool is not initialized"));
|
||||
}
|
||||
|
||||
let position = self.items.iter().position(|(time, _)| *time == timestamp);
|
||||
|
||||
if let Some(p) = position {
|
||||
let start = (p - self.len / 2).max(0);
|
||||
let end = (p + self.len / 2).min(self.items.len() - 1);
|
||||
self.items = self.items.drain(start..end).collect();
|
||||
self.current.replace((timestamp, self.len / 2));
|
||||
return Ok(());
|
||||
} else {
|
||||
self.items.clear();
|
||||
self.init(timestamp, item);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.items.len()
|
||||
}
|
||||
}
|
||||
@ -1,167 +1,55 @@
|
||||
use crate::errors::PoolError;
|
||||
use chrono::prelude::*;
|
||||
use smallvec::SmallVec;
|
||||
use sorted_vec::{SortedSet, SortedVec};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
type PResult<T> = Result<T, PoolError>;
|
||||
|
||||
pub struct Pool<T>
|
||||
pub struct DataPool<T>
|
||||
where
|
||||
T: Send + Sync,
|
||||
{
|
||||
items: VecDeque<(i64, T)>,
|
||||
current: Option<(i64, usize)>,
|
||||
datetime_pool: SortedSet<(DateTime<Utc>, usize)>,
|
||||
items: Vec<T>,
|
||||
current: Option<usize>,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
impl<T> Pool<T>
|
||||
impl<T> DataPool<T>
|
||||
where
|
||||
T: Send + Sync,
|
||||
T: Send + Sync + Ord,
|
||||
{
|
||||
pub fn new(len: usize) -> Self {
|
||||
Pool {
|
||||
items: VecDeque::new(),
|
||||
DataPool {
|
||||
datetime_pool: SortedSet::with_capacity(len),
|
||||
items: Vec::with_capacity(len),
|
||||
current: None,
|
||||
len,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init(&mut self, timestamp: i64, item: T) -> PResult<()> {
|
||||
let len = self.items.len();
|
||||
|
||||
if len == 0 {
|
||||
self.items.push_back((timestamp, item));
|
||||
self.current.replace((timestamp, 0));
|
||||
return Ok(());
|
||||
} else {
|
||||
return Err(PoolError::PoolInitialized("Pool is already initialized"));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add(&mut self, item: T, timestamp: i64) -> PResult<()> {
|
||||
pub fn add(&mut self, item: T, datetime: DateTime<Utc>) -> PResult<()> {
|
||||
let len = self.items.len();
|
||||
if len == self.len {
|
||||
return Err(PoolError::PoolFull);
|
||||
}
|
||||
if len == 0 {
|
||||
return Err(PoolError::PoolInitialized("Pool is not initialized"));
|
||||
}
|
||||
if len == 1 {
|
||||
if self.items[0].0 < timestamp {
|
||||
self.items.push_back((timestamp, item));
|
||||
} else {
|
||||
self.items.push_front((timestamp, item));
|
||||
self.current.replace((timestamp, 1));
|
||||
}
|
||||
return Ok(());
|
||||
self.items.push(item);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
let back = self
|
||||
.items
|
||||
.back()
|
||||
.map(|(last_timestamp, _)| *last_timestamp < timestamp)
|
||||
.unwrap();
|
||||
let front = self
|
||||
.items
|
||||
.front()
|
||||
.map(|(first_timestamp, _)| *first_timestamp > timestamp)
|
||||
.unwrap();
|
||||
|
||||
if !(back || front) {
|
||||
return Err(PoolError::TimestampError);
|
||||
pub fn set_current(&mut self, datetime: DateTime<Utc>) -> PResult<()> {
|
||||
if self.datetime_pool.is_empty() {
|
||||
return Err(PoolError::PoolInitialized("Pool is empty"));
|
||||
}
|
||||
|
||||
if back {
|
||||
self.items.push_back((timestamp, item));
|
||||
} else {
|
||||
self.items.push_front((timestamp, item));
|
||||
self.current.as_mut().map(|(_, index)| *index += 1);
|
||||
if let Some(t) = self.datetime_pool.iter().position(|(x, _)| *x == datetime) {
|
||||
let pre = (t - self.len / 2).max(0);
|
||||
let post = (t + self.len / 2).min(self.len - 1);
|
||||
self.datetime_pool.drain(pre..post);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn prev(&self) -> Option<&T> {
|
||||
self.current
|
||||
.map(|(_, index)| &self.items[index])
|
||||
.map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn next(&mut self) -> Option<&T> {
|
||||
let len = self.items.len();
|
||||
let current = self.current.as_mut().map(|(_, index)| index);
|
||||
|
||||
if let Some(index) = current {
|
||||
if *index + 1 < len {
|
||||
*index += 1;
|
||||
self.current
|
||||
.as_ref()
|
||||
.map(|(_, index)| &self.items[*index])
|
||||
.map(|(_, item)| item)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&self, index: isize) -> Option<&T> {
|
||||
self.current
|
||||
.as_ref()
|
||||
.map(|(_, current_index)| *current_index as isize + index)
|
||||
.and_then(|index| {
|
||||
if index >= 0 && index < self.items.len() as isize {
|
||||
Some(&self.items[index as usize])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self, index: isize) -> Option<&mut T> {
|
||||
self.current
|
||||
.as_ref()
|
||||
.map(|(_, current_index)| *current_index as isize + index)
|
||||
.and_then(|index| {
|
||||
if index >= 0 && index < self.items.len() as isize {
|
||||
Some(&mut self.items[index as usize])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = &T> {
|
||||
self.items.iter().map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T> {
|
||||
self.items.iter_mut().map(|(_, item)| item)
|
||||
}
|
||||
|
||||
pub fn set_current(&mut self, timestamp: i64, item: T) -> PResult<()> {
|
||||
if self.items.len() == 0 {
|
||||
return Err(PoolError::PoolInitialized("Pool is not initialized"));
|
||||
}
|
||||
|
||||
let position = self.items.iter().position(|(time, _)| *time == timestamp);
|
||||
|
||||
if let Some(p) = position {
|
||||
let start = (p - self.len / 2).max(0);
|
||||
let end = (p + self.len / 2).min(self.items.len() - 1);
|
||||
self.items = self.items.drain(start..end).collect();
|
||||
self.current.replace((timestamp, self.len / 2));
|
||||
return Ok(());
|
||||
} else {
|
||||
self.items.clear();
|
||||
self.init(timestamp, item);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.items.len()
|
||||
}
|
||||
pub fn next(&self) {}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use super::render_pipeline::RenderResult;
|
||||
use super::{offscreen_renderer::OffscreenRenderer, pool::Pool};
|
||||
use super::{offscreen_renderer::OffscreenRenderer, pool::DataPool};
|
||||
use crate::coords::proj::Mercator;
|
||||
use crate::coords::Mapper;
|
||||
use crate::widgets::{Render, Target, TargetType, CMS};
|
||||
@ -9,6 +9,8 @@ use futures::future::*;
|
||||
use radarg_plugin_interface::*;
|
||||
use regex::Regex;
|
||||
use smallvec::SmallVec;
|
||||
use std::cell::{Ref, RefCell};
|
||||
use std::rc::Rc;
|
||||
use std::sync::Mutex;
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
@ -30,11 +32,11 @@ pub fn ck() {
|
||||
type RenderR = Result<RenderResult, RenderError>;
|
||||
|
||||
pub struct Pipeline {
|
||||
pool: Option<Vec<BoxFuture<'static, RenderR>>>,
|
||||
switcher: Pool<oneshot::Receiver<i32>>,
|
||||
pool: Option<Vec<BoxFuture<'static, ()>>>,
|
||||
// switcher: Pool<oneshot::Receiver<i32>>,
|
||||
results: SmallVec<[RenderResult; 20]>,
|
||||
dispatcher: Option<Arc<std::sync::Mutex<Dispatcher>>>,
|
||||
handlers: Option<oneshot::Receiver<i32>>,
|
||||
handlers: Option<Vec<oneshot::Receiver<RenderR>>>,
|
||||
handler: Option<mpsc::Receiver<RenderR>>,
|
||||
sender: Option<mpsc::Sender<RenderR>>,
|
||||
key: String,
|
||||
@ -44,7 +46,7 @@ impl Pipeline {
|
||||
pub fn new(len: usize, key: String) -> Self {
|
||||
Self {
|
||||
pool: Some(Vec::new()),
|
||||
switcher: Pool::new(len),
|
||||
// switcher: Pool::new(len),
|
||||
results: SmallVec::new(),
|
||||
dispatcher: None,
|
||||
handlers: None,
|
||||
@ -59,23 +61,38 @@ impl Pipeline {
|
||||
}
|
||||
|
||||
pub fn init(&mut self) -> &mut Self {
|
||||
let (tx, mut rx) = mpsc::channel::<Result<RenderResult, RenderError>>(20);
|
||||
self.handler.replace(rx);
|
||||
self.sender.replace(tx);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_current(&mut self, current_time: DateTime<Utc>, check_existed: bool) {
|
||||
pub fn set_current(
|
||||
&mut self,
|
||||
current_time: DateTime<Utc>,
|
||||
check_existed: bool,
|
||||
) -> Option<Vec<DateTime<Utc>>> {
|
||||
let dispatcher = self.dispatcher.clone().unwrap();
|
||||
let dispatcher = dispatcher.lock().unwrap();
|
||||
let paths = dispatcher.get_path(&self.key, current_time, check_existed);
|
||||
|
||||
if let Some(paths) = paths {
|
||||
let mut recvs = Vec::new();
|
||||
|
||||
let mut result = Vec::new();
|
||||
for (path, datetime) in paths.into_iter() {
|
||||
let sender = self.sender.clone().unwrap();
|
||||
// let sender = self.sender.clone().unwrap();
|
||||
let (sender, mut receiver) = oneshot::channel::<RenderR>();
|
||||
self.add_task(datetime.timestamp(), self.worker(datetime, path), sender);
|
||||
recvs.push(receiver);
|
||||
result.push(datetime);
|
||||
}
|
||||
self.handlers.replace(recvs);
|
||||
Some(result)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn work_num(&self) -> usize {
|
||||
self.pool.as_ref().unwrap().len()
|
||||
}
|
||||
|
||||
fn worker(
|
||||
@ -114,9 +131,7 @@ impl Pipeline {
|
||||
layer.set_render_target(target.unwrap());
|
||||
layer
|
||||
});
|
||||
|
||||
let target = handle.await.unwrap();
|
||||
|
||||
Ok(RenderResult::new(target, datetime))
|
||||
} else {
|
||||
println!("no layer");
|
||||
@ -125,37 +140,53 @@ impl Pipeline {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn add_task<TASK>(&mut self, timestamp: i64, task: TASK, tx: mpsc::Sender<RenderR>)
|
||||
pub fn add_task<TASK>(&mut self, timestamp: i64, task: TASK, tx: oneshot::Sender<RenderR>)
|
||||
where
|
||||
TASK: Future<Output = RenderR> + 'static + Send,
|
||||
{
|
||||
// let (mut tx, rx) = oneshot::channel::<i32>();
|
||||
let future = async move { task.await };
|
||||
let future = async move {
|
||||
let data = task.await;
|
||||
tx.send(data).unwrap();
|
||||
};
|
||||
|
||||
self.pool.as_mut().unwrap().push(Box::pin(future));
|
||||
// self.switcher.add(rx, timestamp);
|
||||
}
|
||||
|
||||
pub fn run(&mut self) -> BoxFuture<'static, ()> {
|
||||
let pool = self.get_pool().unwrap();
|
||||
Box::pin(async move {
|
||||
// let result = join_all(pool).await;
|
||||
for f in pool.into_iter() {
|
||||
f.await;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn listening(&mut self) -> BoxFuture<'static, ()> {
|
||||
let mut handler = self.handler.take().unwrap();
|
||||
pub fn listening<F>(&mut self, f: F) -> BoxFuture<'static, ()>
|
||||
where
|
||||
F: Fn(oneshot::Receiver<RenderR>, usize) -> BoxFuture<'static, ()> + Send + 'static + Sync,
|
||||
{
|
||||
let mut handler = self.handlers.take().unwrap();
|
||||
Box::pin(async move {
|
||||
while let Some(info) = handler.recv().await {
|
||||
println!("recv");
|
||||
let l = handler.into_iter().enumerate().map(|(h, i)| f(i, h));
|
||||
for f in l.into_iter() {
|
||||
f.await;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_pool(&mut self) -> Option<Vec<BoxFuture<'static, RenderR>>> {
|
||||
pub fn listening_one_by_one<F>(&mut self, f: Vec<F>) -> BoxFuture<'static, ()>
|
||||
where
|
||||
F: FnOnce(oneshot::Receiver<RenderR>) -> BoxFuture<'static, ()> + Send + 'static + Sync,
|
||||
{
|
||||
let mut handler = self.handlers.take().unwrap();
|
||||
Box::pin(async move {
|
||||
for (h, f) in handler.into_iter().zip(f) {
|
||||
f(h).await;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_pool(&mut self) -> Option<Vec<BoxFuture<'static, ()>>> {
|
||||
self.pool.take()
|
||||
}
|
||||
|
||||
@ -168,16 +199,23 @@ pub struct Dispatcher {
|
||||
fore_len: usize,
|
||||
back_len: usize,
|
||||
step: Duration,
|
||||
registered_buffer: Rc<RefCell<HashMap<String, Vec<(DateTime<Utc>, Option<RenderResult>)>>>>,
|
||||
}
|
||||
|
||||
impl Dispatcher {
|
||||
pub fn new(fore_len: usize, back_len: usize, step: Duration) -> Self {
|
||||
pub fn new(
|
||||
fore_len: usize,
|
||||
back_len: usize,
|
||||
step: Duration,
|
||||
registered_buffer: Rc<RefCell<HashMap<String, Vec<(DateTime<Utc>, Option<RenderResult>)>>>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
datetime: Utc::now(),
|
||||
path_format: HashMap::new(),
|
||||
fore_len,
|
||||
back_len,
|
||||
step,
|
||||
registered_buffer,
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,10 +253,15 @@ impl Dispatcher {
|
||||
let mut fore = self.fore_len;
|
||||
let mut back = 0;
|
||||
let mut result_paths = Vec::new();
|
||||
|
||||
let buffer: Ref<'_, HashMap<_, _>> = (*self.registered_buffer).borrow();
|
||||
let buffer = buffer.get(name).unwrap();
|
||||
while fore > 0 {
|
||||
let mut result_path = path.clone();
|
||||
let t = current_time - self.step * fore as i32;
|
||||
if buffer.iter().position(|(dt, _)| *dt == t).is_some() {
|
||||
fore = fore - 1;
|
||||
continue;
|
||||
}
|
||||
for need_format in need_formated.iter() {
|
||||
let fmt = need_format.get(0).unwrap().as_str();
|
||||
let t = t.format(fmt).to_string();
|
||||
@ -240,6 +283,10 @@ impl Dispatcher {
|
||||
while back < self.back_len {
|
||||
let mut result_path = path.clone();
|
||||
let t = current_time + self.step * back as i32;
|
||||
if buffer.iter().position(|(dt, _)| *dt == t).is_some() {
|
||||
back = back + 1;
|
||||
continue;
|
||||
}
|
||||
for need_format in need_formated.iter() {
|
||||
let fmt = need_format.get(0).unwrap().as_str();
|
||||
let t = t.format(fmt).to_string();
|
||||
@ -352,14 +399,4 @@ fn data_to_layer(block: Block) -> Option<(DateTime<Utc>, Layer)> {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_send_sync() {
|
||||
fn assert_send<T: Send>() {}
|
||||
fn assert_sync<T: Sync>() {}
|
||||
|
||||
assert_send::<Pipeline>(); // 如果 MyStruct 不是 Send,这里会编译失败
|
||||
|
||||
assert_send::<RenderResult>();
|
||||
}
|
||||
|
||||
// Pin<Box<dyn Future<Output = Result<Vec<RenderResult>, RenderError>> + Send + 'static>>
|
||||
|
||||
@ -113,7 +113,7 @@ impl Layer {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, PartialEq, PartialOrd)]
|
||||
pub struct Target {
|
||||
pub target: TargetType,
|
||||
pub thumbnail: Option<gtk::gdk::Texture>,
|
||||
@ -122,7 +122,7 @@ pub struct Target {
|
||||
pub bounds: (Range, Range),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord)]
|
||||
pub enum TargetType {
|
||||
ImageId(ImageId),
|
||||
Mem(Vec<u8>),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user