Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8747ac3e8c | ||
![]() |
e8a0051ea7 |
401
Cargo.lock
generated
401
Cargo.lock
generated
|
@ -76,7 +76,7 @@ dependencies = [
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"h2",
|
"h2 0.3.26",
|
||||||
"http 0.2.12",
|
"http 0.2.12",
|
||||||
"httparse",
|
"httparse",
|
||||||
"httpdate",
|
"httpdate",
|
||||||
|
@ -168,7 +168,7 @@ dependencies = [
|
||||||
"impl-more",
|
"impl-more",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-rustls",
|
"tokio-rustls 0.24.1",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"tracing",
|
"tracing",
|
||||||
"webpki-roots",
|
"webpki-roots",
|
||||||
|
@ -879,7 +879,7 @@ dependencies = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"serde",
|
"serde",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -899,7 +899,7 @@ dependencies = [
|
||||||
"cocoa-foundation",
|
"cocoa-foundation",
|
||||||
"core-foundation",
|
"core-foundation",
|
||||||
"core-graphics",
|
"core-graphics",
|
||||||
"foreign-types",
|
"foreign-types 0.5.0",
|
||||||
"libc",
|
"libc",
|
||||||
"objc",
|
"objc",
|
||||||
]
|
]
|
||||||
|
@ -996,7 +996,7 @@ dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"core-foundation",
|
"core-foundation",
|
||||||
"core-graphics-types",
|
"core-graphics-types",
|
||||||
"foreign-types",
|
"foreign-types 0.5.0",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1693,6 +1693,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"shared",
|
"shared",
|
||||||
|
@ -1751,6 +1752,15 @@ version = "1.0.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
name = "foreign-types"
|
name = "foreign-types"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
|
@ -1758,7 +1768,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
|
checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"foreign-types-macros",
|
"foreign-types-macros",
|
||||||
"foreign-types-shared",
|
"foreign-types-shared 0.3.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1772,6 +1782,12 @@ dependencies = [
|
||||||
"syn 2.0.61",
|
"syn 2.0.61",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foreign-types-shared"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "foreign-types-shared"
|
name = "foreign-types-shared"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
@ -2367,6 +2383,25 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "h2"
|
||||||
|
version = "0.4.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e"
|
||||||
|
dependencies = [
|
||||||
|
"atomic-waker",
|
||||||
|
"bytes",
|
||||||
|
"fnv",
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
"http 1.1.0",
|
||||||
|
"indexmap 2.2.6",
|
||||||
|
"slab",
|
||||||
|
"tokio",
|
||||||
|
"tokio-util",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.12.3"
|
version = "0.12.3"
|
||||||
|
@ -2526,6 +2561,7 @@ dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"h2 0.4.7",
|
||||||
"http 1.1.0",
|
"http 1.1.0",
|
||||||
"http-body",
|
"http-body",
|
||||||
"httparse",
|
"httparse",
|
||||||
|
@ -2536,6 +2572,39 @@ dependencies = [
|
||||||
"want",
|
"want",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper-rustls"
|
||||||
|
version = "0.27.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
|
||||||
|
dependencies = [
|
||||||
|
"futures-util",
|
||||||
|
"http 1.1.0",
|
||||||
|
"hyper",
|
||||||
|
"hyper-util",
|
||||||
|
"rustls 0.23.7",
|
||||||
|
"rustls-pki-types",
|
||||||
|
"tokio",
|
||||||
|
"tokio-rustls 0.26.0",
|
||||||
|
"tower-service",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper-tls"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"http-body-util",
|
||||||
|
"hyper",
|
||||||
|
"hyper-util",
|
||||||
|
"native-tls",
|
||||||
|
"tokio",
|
||||||
|
"tokio-native-tls",
|
||||||
|
"tower-service",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-util"
|
name = "hyper-util"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
@ -2902,7 +2971,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
|
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.48.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3173,7 +3242,7 @@ dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"parking_lot 0.12.2",
|
"parking_lot 0.12.2",
|
||||||
"qrcode",
|
"qrcode",
|
||||||
"rustls",
|
"rustls 0.21.11",
|
||||||
"rustls-pemfile",
|
"rustls-pemfile",
|
||||||
"serde",
|
"serde",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
@ -3223,6 +3292,23 @@ dependencies = [
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
name = "ndk"
|
name = "ndk"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
|
@ -3444,6 +3530,50 @@ version = "1.19.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl"
|
||||||
|
version = "0.10.68"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.5.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.61",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
name = "option-ext"
|
name = "option-ext"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -3548,7 +3678,7 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"smallvec 1.13.2",
|
"smallvec 1.13.2",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4140,31 +4270,39 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reqwest"
|
name = "reqwest"
|
||||||
version = "0.12.4"
|
version = "0.12.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10"
|
checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"encoding_rs",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"h2 0.4.7",
|
||||||
"http 1.1.0",
|
"http 1.1.0",
|
||||||
"http-body",
|
"http-body",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"hyper",
|
"hyper",
|
||||||
|
"hyper-rustls",
|
||||||
|
"hyper-tls",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"ipnet",
|
"ipnet",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"mime",
|
"mime",
|
||||||
|
"native-tls",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
"rustls-pemfile",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"sync_wrapper",
|
"sync_wrapper",
|
||||||
|
"system-configuration",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"tokio-native-tls",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"url",
|
"url",
|
||||||
|
@ -4172,7 +4310,7 @@ dependencies = [
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"wasm-streams",
|
"wasm-streams",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"winreg",
|
"windows-registry",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4238,6 +4376,13 @@ dependencies = [
|
||||||
"wit-bindgen-rt",
|
"wit-bindgen-rt",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rust_diagram_connector"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.23"
|
version = "0.1.23"
|
||||||
|
@ -4282,10 +4427,23 @@ checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"ring",
|
"ring",
|
||||||
"rustls-webpki",
|
"rustls-webpki 0.101.7",
|
||||||
"sct",
|
"sct",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustls"
|
||||||
|
version = "0.23.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ebbbdb961df0ad3f2652da8f3fdc4b36122f568f968f45ad3316f26c025c677b"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
"rustls-pki-types",
|
||||||
|
"rustls-webpki 0.102.3",
|
||||||
|
"subtle",
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-pemfile"
|
name = "rustls-pemfile"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
|
@ -4312,6 +4470,17 @@ dependencies = [
|
||||||
"untrusted",
|
"untrusted",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustls-webpki"
|
||||||
|
version = "0.102.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf"
|
||||||
|
dependencies = [
|
||||||
|
"ring",
|
||||||
|
"rustls-pki-types",
|
||||||
|
"untrusted",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustversion"
|
name = "rustversion"
|
||||||
version = "1.0.15"
|
version = "1.0.15"
|
||||||
|
@ -4344,6 +4513,15 @@ dependencies = [
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[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]]
|
[[package]]
|
||||||
name = "schemars"
|
name = "schemars"
|
||||||
version = "0.8.19"
|
version = "0.8.19"
|
||||||
|
@ -4392,6 +4570,29 @@ dependencies = [
|
||||||
"untrusted",
|
"untrusted",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "security-framework"
|
||||||
|
version = "2.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.5.0",
|
||||||
|
"core-foundation",
|
||||||
|
"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]]
|
[[package]]
|
||||||
name = "selectors"
|
name = "selectors"
|
||||||
version = "0.22.0"
|
version = "0.22.0"
|
||||||
|
@ -4698,7 +4899,7 @@ dependencies = [
|
||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
"cocoa",
|
"cocoa",
|
||||||
"core-graphics",
|
"core-graphics",
|
||||||
"foreign-types",
|
"foreign-types 0.5.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"log",
|
"log",
|
||||||
"objc",
|
"objc",
|
||||||
|
@ -4833,6 +5034,12 @@ dependencies = [
|
||||||
"syn 2.0.61",
|
"syn 2.0.61",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "subtle"
|
||||||
|
version = "2.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "swift-rs"
|
name = "swift-rs"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
|
@ -4868,9 +5075,33 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sync_wrapper"
|
name = "sync_wrapper"
|
||||||
version = "0.1.2"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "system-configuration"
|
||||||
|
version = "0.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.5.0",
|
||||||
|
"core-foundation",
|
||||||
|
"system-configuration-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "system-configuration-sys"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "system-deps"
|
name = "system-deps"
|
||||||
|
@ -5370,13 +5601,34 @@ dependencies = [
|
||||||
"syn 2.0.61",
|
"syn 2.0.61",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-native-tls"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
|
||||||
|
dependencies = [
|
||||||
|
"native-tls",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-rustls"
|
name = "tokio-rustls"
|
||||||
version = "0.24.1"
|
version = "0.24.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
|
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustls",
|
"rustls 0.21.11",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-rustls"
|
||||||
|
version = "0.26.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
|
||||||
|
dependencies = [
|
||||||
|
"rustls 0.23.7",
|
||||||
|
"rustls-pki-types",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5775,6 +6027,12 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vcpkg"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version-compare"
|
name = "version-compare"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -6518,7 +6776,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132"
|
checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-core 0.56.0",
|
"windows-core 0.56.0",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -6527,7 +6785,7 @@ version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -6538,8 +6796,8 @@ checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-implement",
|
"windows-implement",
|
||||||
"windows-interface",
|
"windows-interface",
|
||||||
"windows-result",
|
"windows-result 0.1.1",
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -6564,13 +6822,43 @@ dependencies = [
|
||||||
"syn 2.0.61",
|
"syn 2.0.61",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-registry"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
|
||||||
|
dependencies = [
|
||||||
|
"windows-result 0.2.0",
|
||||||
|
"windows-strings",
|
||||||
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-result"
|
name = "windows-result"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b"
|
checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-result"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-strings"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
|
||||||
|
dependencies = [
|
||||||
|
"windows-result 0.2.0",
|
||||||
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -6597,7 +6885,16 @@ version = "0.52.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -6632,18 +6929,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-targets"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows_aarch64_gnullvm 0.52.5",
|
"windows_aarch64_gnullvm 0.52.6",
|
||||||
"windows_aarch64_msvc 0.52.5",
|
"windows_aarch64_msvc 0.52.6",
|
||||||
"windows_i686_gnu 0.52.5",
|
"windows_i686_gnu 0.52.6",
|
||||||
"windows_i686_gnullvm",
|
"windows_i686_gnullvm",
|
||||||
"windows_i686_msvc 0.52.5",
|
"windows_i686_msvc 0.52.6",
|
||||||
"windows_x86_64_gnu 0.52.5",
|
"windows_x86_64_gnu 0.52.6",
|
||||||
"windows_x86_64_gnullvm 0.52.5",
|
"windows_x86_64_gnullvm 0.52.6",
|
||||||
"windows_x86_64_msvc 0.52.5",
|
"windows_x86_64_msvc 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -6652,7 +6949,7 @@ version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6998aa457c9ba8ff2fb9f13e9d2a930dabcea28f1d0ab94d687d8b3654844515"
|
checksum = "6998aa457c9ba8ff2fb9f13e9d2a930dabcea28f1d0ab94d687d8b3654844515"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets 0.52.5",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -6669,9 +6966,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
|
@ -6687,9 +6984,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
|
@ -6705,15 +7002,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnullvm"
|
name = "windows_i686_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
|
@ -6729,9 +7026,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
|
@ -6747,9 +7044,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
|
@ -6765,9 +7062,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
|
@ -6783,9 +7080,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
|
@ -7016,6 +7313,12 @@ dependencies = [
|
||||||
"syn 2.0.61",
|
"syn 2.0.61",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zeroize"
|
||||||
|
version = "1.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zoon"
|
name = "zoon"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -3,7 +3,9 @@ members = [
|
||||||
"frontend",
|
"frontend",
|
||||||
"backend",
|
"backend",
|
||||||
"shared",
|
"shared",
|
||||||
"src-tauri", "test_files/components/rust_decoder",
|
"src-tauri",
|
||||||
|
"test_files/components/rust_decoder",
|
||||||
|
"test_files/components/rust_diagram_connector",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
|
|
@ -76,5 +76,15 @@ mod js_bridge {
|
||||||
|
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
pub fn draw_diagram_element(this: &ExcalidrawController, excalidraw_element: JsValue);
|
pub fn draw_diagram_element(this: &ExcalidrawController, excalidraw_element: JsValue);
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn listen_for_component_text_changes(
|
||||||
|
this: &ExcalidrawController,
|
||||||
|
component_id: &str,
|
||||||
|
on_change: &Closure<dyn Fn(String)>,
|
||||||
|
);
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn set_component_text(this: &ExcalidrawController, component_id: &str, text: &str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ impl HeaderPanel {
|
||||||
.s(Gap::both(15))
|
.s(Gap::both(15))
|
||||||
.item(self.load_button())
|
.item(self.load_button())
|
||||||
.item(self.layout_switcher())
|
.item(self.layout_switcher())
|
||||||
.item(self.mode_switcher()),
|
.item(self.mode_switcher())
|
||||||
|
.item(self.open_konata_file()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,4 +194,22 @@ impl HeaderPanel {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn open_konata_file(&self) -> impl Element {
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(Align::new().left())
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.label(
|
||||||
|
El::new()
|
||||||
|
.s(Font::new().no_wrap())
|
||||||
|
.child("Open Konata file.."),
|
||||||
|
)
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || Task::start(platform::open_konata_file()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use std::sync::Arc;
|
use shared::DiagramConnectorMessage;
|
||||||
|
use std::{mem, sync::Arc};
|
||||||
use zoon::*;
|
use zoon::*;
|
||||||
|
|
||||||
mod platform;
|
mod platform;
|
||||||
|
@ -53,11 +54,53 @@ static STORE: Lazy<Store> = lazy::default();
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
start_app("app", root);
|
start_app("app", root);
|
||||||
|
|
||||||
Task::start(async {
|
Task::start(async {
|
||||||
// https://github.com/tauri-apps/tauri/issues/5170
|
// https://github.com/tauri-apps/tauri/issues/5170
|
||||||
Timer::sleep(100).await;
|
Timer::sleep(100).await;
|
||||||
platform::show_window().await;
|
platform::show_window().await;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Task::start(async {
|
||||||
|
platform::listen_diagram_connectors_messages(|message| {
|
||||||
|
match message {
|
||||||
|
DiagramConnectorMessage::ListenForComponentTextChanges {
|
||||||
|
diagram_connector_name,
|
||||||
|
component_id,
|
||||||
|
} => {
|
||||||
|
let closure = Closure::new({
|
||||||
|
// @TODO Rcs/Arcs?
|
||||||
|
let diagram_connector_name = diagram_connector_name.clone();
|
||||||
|
let component_id = component_id.clone();
|
||||||
|
move |text| {
|
||||||
|
Task::start(platform::notify_diagram_connector_text_change(
|
||||||
|
diagram_connector_name.clone(),
|
||||||
|
component_id.clone(),
|
||||||
|
text,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
STORE
|
||||||
|
.excalidraw_canvas_controller
|
||||||
|
.lock_ref()
|
||||||
|
.lock_ref()
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_throw()
|
||||||
|
.listen_for_component_text_changes(&component_id, &closure);
|
||||||
|
// @TODO don't forget
|
||||||
|
mem::forget(closure);
|
||||||
|
}
|
||||||
|
DiagramConnectorMessage::SetComponentText { component_id, text } => STORE
|
||||||
|
.excalidraw_canvas_controller
|
||||||
|
.lock_ref()
|
||||||
|
.lock_ref()
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_throw()
|
||||||
|
.set_component_text(&component_id, &text),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn root() -> impl Element {
|
fn root() -> impl Element {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
// NOTE: `FASTWAVE_PLATFORM` is set in `Makefile.toml` tasks and then in `build.rs`
|
// NOTE: `FASTWAVE_PLATFORM` is set in `Makefile.toml` tasks and then in `build.rs`
|
||||||
|
|
||||||
use crate::STORE;
|
use crate::STORE;
|
||||||
|
use shared::DiagramConnectorMessage;
|
||||||
|
|
||||||
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
|
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
|
||||||
mod tauri;
|
mod tauri;
|
||||||
|
@ -17,10 +18,17 @@ use browser as platform;
|
||||||
|
|
||||||
type Filename = String;
|
type Filename = String;
|
||||||
type JavascriptCode = String;
|
type JavascriptCode = String;
|
||||||
|
|
||||||
type AddedDecodersCount = usize;
|
type AddedDecodersCount = usize;
|
||||||
type RemovedDecodersCount = usize;
|
type RemovedDecodersCount = usize;
|
||||||
type DecoderPath = String;
|
type DecoderPath = String;
|
||||||
|
|
||||||
|
type AddedDiagramConnectorsCount = usize;
|
||||||
|
type RemovedDiagramConnectorsCount = usize;
|
||||||
|
type DiagramConnectorPath = String;
|
||||||
|
type DiagramConnectorName = String;
|
||||||
|
type ComponentId = String;
|
||||||
|
|
||||||
pub async fn show_window() {
|
pub async fn show_window() {
|
||||||
platform::show_window().await
|
platform::show_window().await
|
||||||
}
|
}
|
||||||
|
@ -85,3 +93,33 @@ async fn redraw_all_timeline_rows() {
|
||||||
controller.redraw_all_rows().await
|
controller.redraw_all_rows().await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<DecoderPath>,
|
||||||
|
) -> AddedDecodersCount {
|
||||||
|
let count = platform::add_diagram_connectors(diagram_connector_paths).await;
|
||||||
|
count
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn remove_all_diagram_connectors() -> RemovedDecodersCount {
|
||||||
|
let count = platform::remove_all_diagram_connectors().await;
|
||||||
|
count
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn listen_diagram_connectors_messages(
|
||||||
|
on_message: impl FnMut(DiagramConnectorMessage) + 'static,
|
||||||
|
) {
|
||||||
|
platform::listen_diagram_connectors_messages(on_message).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: DiagramConnectorName,
|
||||||
|
component_id: ComponentId,
|
||||||
|
text: String,
|
||||||
|
) {
|
||||||
|
platform::notify_diagram_connector_text_change(diagram_connector, component_id, text).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn open_konata_file() {
|
||||||
|
platform::open_konata_file().await;
|
||||||
|
}
|
||||||
|
|
|
@ -136,3 +136,38 @@ pub(super) async fn remove_all_decoders() -> super::RemovedDecodersCount {
|
||||||
eprintln!("Removing decoders is not supported in the browser.");
|
eprintln!("Removing decoders is not supported in the browser.");
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<super::DecoderPath>,
|
||||||
|
) -> super::AddedDecodersCount {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Adding diagram connectors is not supported in the browser.");
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn remove_all_diagram_connectors() -> super::RemovedDiagramConnectorsCount {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Removing diagram connectors is not supported in the browser.");
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn listen_diagram_connectors_messages(
|
||||||
|
on_message: impl FnMut(DiagramConnectorMessage) + 'static,
|
||||||
|
) {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Removing listen for diagram connectors messages is not supported in the browser.");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: DiagramConnectorName,
|
||||||
|
component_id: ComponentId,
|
||||||
|
text: String,
|
||||||
|
) {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Diagram connectors notifications are not supported in the browser.");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn open_konata_file() {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Opening Konata files is not supported in the browser.");
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use shared::DiagramConnectorMessage;
|
||||||
use zoon::*;
|
use zoon::*;
|
||||||
|
|
||||||
pub(super) async fn show_window() {
|
pub(super) async fn show_window() {
|
||||||
|
@ -68,6 +69,48 @@ pub(super) async fn remove_all_decoders() -> super::RemovedDecodersCount {
|
||||||
.unwrap_throw()
|
.unwrap_throw()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<super::DecoderPath>,
|
||||||
|
) -> super::AddedDiagramConnectorsCount {
|
||||||
|
serde_wasm_bindgen::from_value(
|
||||||
|
tauri_glue::add_diagram_connectors(diagram_connector_paths)
|
||||||
|
.await
|
||||||
|
.unwrap_throw(),
|
||||||
|
)
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn remove_all_diagram_connectors() -> super::RemovedDiagramConnectorsCount {
|
||||||
|
serde_wasm_bindgen::from_value(
|
||||||
|
tauri_glue::remove_all_diagram_connectors()
|
||||||
|
.await
|
||||||
|
.unwrap_throw(),
|
||||||
|
)
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn listen_diagram_connectors_messages(
|
||||||
|
mut on_message: impl FnMut(DiagramConnectorMessage) + 'static,
|
||||||
|
) {
|
||||||
|
let on_message =
|
||||||
|
move |message: JsValue| on_message(serde_wasm_bindgen::from_value(message).unwrap_throw());
|
||||||
|
tauri_glue::listen_diagram_connectors_messages(Closure::new(on_message).into_js_value()).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: super::DiagramConnectorName,
|
||||||
|
component_id: super::ComponentId,
|
||||||
|
text: String,
|
||||||
|
) {
|
||||||
|
tauri_glue::notify_diagram_connector_text_change(diagram_connector, component_id, text)
|
||||||
|
.await
|
||||||
|
.unwrap_throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn open_konata_file() {
|
||||||
|
tauri_glue::open_konata_file().await;
|
||||||
|
}
|
||||||
|
|
||||||
mod tauri_glue {
|
mod tauri_glue {
|
||||||
use zoon::*;
|
use zoon::*;
|
||||||
|
|
||||||
|
@ -106,5 +149,24 @@ mod tauri_glue {
|
||||||
|
|
||||||
#[wasm_bindgen(catch)]
|
#[wasm_bindgen(catch)]
|
||||||
pub async fn remove_all_decoders() -> Result<JsValue, JsValue>;
|
pub async fn remove_all_decoders() -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<super::super::DiagramConnectorPath>,
|
||||||
|
) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn remove_all_diagram_connectors() -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
pub async fn listen_diagram_connectors_messages(on_event: JsValue);
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: super::super::DiagramConnectorName,
|
||||||
|
component_id: super::super::ComponentId,
|
||||||
|
text: String,
|
||||||
|
) -> Result<(), JsValue>;
|
||||||
|
|
||||||
|
pub async fn open_konata_file();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,15 @@ use wellen::GetItem;
|
||||||
use zoon::*;
|
use zoon::*;
|
||||||
|
|
||||||
type FullVarName = String;
|
type FullVarName = String;
|
||||||
|
|
||||||
type AddedDecodersCount = usize;
|
type AddedDecodersCount = usize;
|
||||||
type RemovedDecodersCount = usize;
|
type RemovedDecodersCount = usize;
|
||||||
type DecoderPath = String;
|
type DecoderPath = String;
|
||||||
|
|
||||||
|
type AddedDiagramConnectorsCount = usize;
|
||||||
|
type RemovedDiagramConnectorsCount = usize;
|
||||||
|
type DiagramConnectorPath = String;
|
||||||
|
|
||||||
#[wasm_bindgen(module = "/typescript/bundles/strict_eval.js")]
|
#[wasm_bindgen(module = "/typescript/bundles/strict_eval.js")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[wasm_bindgen(catch)]
|
#[wasm_bindgen(catch)]
|
||||||
|
@ -91,4 +96,16 @@ impl FW {
|
||||||
controller.draw_diagram_element(excalidraw_element)
|
controller.draw_diagram_element(excalidraw_element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.add_diagram_connectors(["../test_files/components/rust_diagram_connector/rust_diagram_connector.wasm"])` -> `1`
|
||||||
|
pub async fn add_diagram_connectors(
|
||||||
|
connector_paths: Vec<DiagramConnectorPath>,
|
||||||
|
) -> AddedDiagramConnectorsCount {
|
||||||
|
platform::add_diagram_connectors(connector_paths).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.remove_all_diagram_connectors()` -> `5`
|
||||||
|
pub async fn remove_all_diagram_connectors() -> RemovedDiagramConnectorsCount {
|
||||||
|
platform::remove_all_diagram_connectors().await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -7,17 +7,64 @@ import * as React from 'react'
|
||||||
import * as ReactDOM from 'react-dom/client'
|
import * as ReactDOM from 'react-dom/client'
|
||||||
|
|
||||||
export class ExcalidrawController {
|
export class ExcalidrawController {
|
||||||
api: ExcalidrawImperativeAPI | undefined
|
api: Promise<ExcalidrawImperativeAPI>
|
||||||
|
resolve_api: (api: ExcalidrawImperativeAPI) => void
|
||||||
|
|
||||||
constructor() {}
|
constructor() {
|
||||||
|
this.resolve_api = (api) => {};
|
||||||
|
this.api = new Promise(resolve => {
|
||||||
|
this.resolve_api = (api) => resolve(api)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
draw_diagram_element(excalidraw_element: ExcalidrawElement) {
|
draw_diagram_element(excalidraw_element: ExcalidrawElement) {
|
||||||
if (typeof this.api !== 'undefined') {
|
this.api.then(api => {
|
||||||
const elements = this.api.getSceneElements()
|
const elements = api.getSceneElements()
|
||||||
this.api.updateScene({
|
api.updateScene({
|
||||||
elements: elements.concat(excalidraw_element)
|
elements: elements.concat(excalidraw_element)
|
||||||
})
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listen_for_component_text_changes(id: string, on_change: (text: string) => void) {
|
||||||
|
this.api.then(api => {
|
||||||
|
let old_text: string | null = null;
|
||||||
|
api.onChange((elements: readonly ExcalidrawElement[]) => {
|
||||||
|
const element = elements.find(element => element.id === id);
|
||||||
|
if (typeof element !== 'undefined') {
|
||||||
|
if (element.type === 'text') {
|
||||||
|
if (old_text === null) {
|
||||||
|
old_text = element.text;
|
||||||
|
on_change(old_text);
|
||||||
|
} else {
|
||||||
|
if (old_text !== element.text) {
|
||||||
|
old_text = element.text;
|
||||||
|
on_change(old_text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
set_component_text(id: string, text: string) {
|
||||||
|
this.api.then(api => {
|
||||||
|
let element_found = false;
|
||||||
|
const elements = api.getSceneElements().map(element => {
|
||||||
|
if (element.id === id) {
|
||||||
|
element_found = true;
|
||||||
|
return { ...element, text: text, originalText: text }
|
||||||
|
} else {
|
||||||
|
return element
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (element_found) {
|
||||||
|
api.updateScene({
|
||||||
|
elements
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(parent_element: HTMLElement) {
|
async init(parent_element: HTMLElement) {
|
||||||
|
@ -37,7 +84,7 @@ export class ExcalidrawController {
|
||||||
// Font family: Code
|
// Font family: Code
|
||||||
currentItemFontFamily: 3,
|
currentItemFontFamily: 3,
|
||||||
}}}
|
}}}
|
||||||
excalidrawAPI={(api) => this.api = api}
|
excalidrawAPI={(api) => this.resolve_api(api)}
|
||||||
>
|
>
|
||||||
<MainMenu>
|
<MainMenu>
|
||||||
<MainMenu.DefaultItems.LoadScene />
|
<MainMenu.DefaultItems.LoadScene />
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
// @TODO use TS and Tauri bindgens to make this code properly typed
|
// @TODO use TS and Tauri bindgens to make this code properly typed
|
||||||
|
|
||||||
import { core } from '@tauri-apps/api'
|
import { core, event } from '@tauri-apps/api'
|
||||||
|
|
||||||
const invoke = core.invoke;
|
const invoke = core.invoke;
|
||||||
|
const listen = event.listen;
|
||||||
|
|
||||||
type Filename = string;
|
type Filename = string;
|
||||||
type JavascriptCode = string;
|
type JavascriptCode = string;
|
||||||
type WellenHierarchy = unknown;
|
type WellenHierarchy = unknown;
|
||||||
type Timeline = unknown;
|
type Timeline = unknown;
|
||||||
type VarFormat = unknown;
|
type VarFormat = unknown;
|
||||||
|
|
||||||
type AddedDecodersCount = number;
|
type AddedDecodersCount = number;
|
||||||
type RemovedDecodersCount = number;
|
type RemovedDecodersCount = number;
|
||||||
type DecoderPath = string;
|
type DecoderPath = string;
|
||||||
|
|
||||||
|
type AddedDiagramConnectorsCount = number;
|
||||||
|
type RemovedDiagramConnectorsCount = number;
|
||||||
|
type DiagramConnectorPath = string;
|
||||||
|
type DiagramConnectorName = string;
|
||||||
|
type ComponentId = string;
|
||||||
|
|
||||||
export async function show_window(): Promise<void> {
|
export async function show_window(): Promise<void> {
|
||||||
return await invoke("show_window");
|
return await invoke("show_window");
|
||||||
}
|
}
|
||||||
|
@ -58,3 +66,23 @@ export async function add_decoders(decoder_paths: Array<DecoderPath>): Promise<A
|
||||||
export async function remove_all_decoders(): Promise<RemovedDecodersCount> {
|
export async function remove_all_decoders(): Promise<RemovedDecodersCount> {
|
||||||
return await invoke("remove_all_decoders");
|
return await invoke("remove_all_decoders");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function add_diagram_connectors(diagram_connector_paths: Array<DiagramConnectorPath>): Promise<AddedDiagramConnectorsCount> {
|
||||||
|
return await invoke("add_diagram_connectors", { diagram_connector_paths });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function remove_all_diagram_connectors(): Promise<RemovedDiagramConnectorsCount> {
|
||||||
|
return await invoke("remove_all_diagram_connectors");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function listen_diagram_connectors_messages(on_message: (message: any) => void) {
|
||||||
|
return await listen("diagram_connector_message", (message) => on_message(message.payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function notify_diagram_connector_text_change(diagram_connector: DiagramConnectorName, component_id: ComponentId, text: string): Promise<void> {
|
||||||
|
return await invoke("notify_diagram_connector_text_change", { diagram_connector, component_id, text });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function open_konata_file() {
|
||||||
|
return await invoke("open_konata_file");
|
||||||
|
}
|
||||||
|
|
|
@ -30,3 +30,16 @@ pub struct TimeLineBlockLabel {
|
||||||
pub x: u32,
|
pub x: u32,
|
||||||
pub y: u32,
|
pub y: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
|
#[serde(crate = "serde")]
|
||||||
|
pub enum DiagramConnectorMessage {
|
||||||
|
ListenForComponentTextChanges {
|
||||||
|
diagram_connector_name: String,
|
||||||
|
component_id: String,
|
||||||
|
},
|
||||||
|
SetComponentText {
|
||||||
|
component_id: String,
|
||||||
|
text: String,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ tauri-plugin-window-state = "=2.0.0-beta.9"
|
||||||
tauri-plugin-dialog = "=2.0.0-beta.9"
|
tauri-plugin-dialog = "=2.0.0-beta.9"
|
||||||
once_cell = "1.19.0"
|
once_cell = "1.19.0"
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
|
reqwest = "0.12.9"
|
||||||
|
|
||||||
# wasmtime = "22.0.0"
|
# wasmtime = "22.0.0"
|
||||||
# wasmtime-wasi = "22.0.0"
|
# wasmtime-wasi = "22.0.0"
|
||||||
|
|
|
@ -1,125 +1,2 @@
|
||||||
use crate::{AddedDecodersCount, DecoderPath, RemovedDecodersCount};
|
pub mod decoders;
|
||||||
use once_cell::sync::Lazy;
|
pub mod diagram_connectors;
|
||||||
use std::sync::Arc;
|
|
||||||
use tauri::async_runtime::{Mutex, RwLock};
|
|
||||||
use wasmtime::component::{Component as WasmtimeComponent, *};
|
|
||||||
use wasmtime::{AsContextMut, Engine, Store};
|
|
||||||
use wasmtime_wasi::{WasiCtx, WasiView};
|
|
||||||
|
|
||||||
bindgen!();
|
|
||||||
|
|
||||||
pub static DECODERS: Lazy<Arc<RwLock<Vec<Component>>>> = Lazy::new(<_>::default);
|
|
||||||
static ENGINE: Lazy<Engine> = Lazy::new(<_>::default);
|
|
||||||
static LINKER: Lazy<Linker<State>> = Lazy::new(|| {
|
|
||||||
let mut linker = Linker::new(&ENGINE);
|
|
||||||
wasmtime_wasi::add_to_linker_sync(&mut linker).unwrap();
|
|
||||||
Component::add_to_linker(&mut linker, |state: &mut State| state).unwrap();
|
|
||||||
linker
|
|
||||||
});
|
|
||||||
pub static STORE: Lazy<Arc<Mutex<Store<State>>>> = Lazy::new(|| {
|
|
||||||
let store = Store::new(
|
|
||||||
&ENGINE,
|
|
||||||
State {
|
|
||||||
ctx: WasiCtx::builder().build(),
|
|
||||||
table: ResourceTable::new(),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
Arc::new(Mutex::new(store))
|
|
||||||
});
|
|
||||||
|
|
||||||
pub struct State {
|
|
||||||
ctx: WasiCtx,
|
|
||||||
table: ResourceTable,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WasiView for State {
|
|
||||||
fn ctx(&mut self) -> &mut WasiCtx {
|
|
||||||
&mut self.ctx
|
|
||||||
}
|
|
||||||
fn table(&mut self) -> &mut ResourceTable {
|
|
||||||
&mut self.table
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl component::decoder::host::Host for State {
|
|
||||||
fn log(&mut self, message: String) {
|
|
||||||
println!("Decoder: {message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn remove_all_decoders() -> RemovedDecodersCount {
|
|
||||||
let mut decoders = DECODERS.write().await;
|
|
||||||
let decoders_count = decoders.len();
|
|
||||||
decoders.clear();
|
|
||||||
decoders_count
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO Make println work on Windows in release mode?
|
|
||||||
// https://github.com/tauri-apps/tauri/discussions/8626
|
|
||||||
|
|
||||||
// @TODO Remove / improve comments below
|
|
||||||
// Testing
|
|
||||||
//
|
|
||||||
// Rust
|
|
||||||
// FW.add_decoders(["../test_files/components/rust_decoder/rust_decoder.wasm"])
|
|
||||||
// FW.add_decoders(["../test_files/components/rust_decoder/rust_decoder.wasm", "../test_files/components/rust_decoder/rust_decoder.wasm"])
|
|
||||||
//
|
|
||||||
// JS
|
|
||||||
// FW.add_decoders(["../test_files/components/javascript_decoder/javascript_decoder.wasm"])
|
|
||||||
//
|
|
||||||
// Python
|
|
||||||
// FW.add_decoders(["../test_files/components/python_decoder/python_decoder.wasm"])
|
|
||||||
//
|
|
||||||
// Remove all
|
|
||||||
// FW.remove_all_decoders()
|
|
||||||
//
|
|
||||||
// All Debug
|
|
||||||
// FW.add_decoders(["../test_files/components/rust_decoder/rust_decoder.wasm", "../test_files/components/javascript_decoder/javascript_decoder.wasm", "../test_files/components/python_decoder/python_decoder.wasm"])
|
|
||||||
//
|
|
||||||
// All Release
|
|
||||||
// FW.add_decoders(["../../test_files/components/rust_decoder/rust_decoder.wasm", "../../test_files/components/javascript_decoder/javascript_decoder.wasm", "../../test_files/components/python_decoder/python_decoder.wasm"])
|
|
||||||
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {
|
|
||||||
println!("Decoders: {decoder_paths:#?}");
|
|
||||||
println!("Current dir: {:#?}", std::env::current_dir().unwrap());
|
|
||||||
|
|
||||||
let mut added_decoders_count = 0;
|
|
||||||
|
|
||||||
// @TODO (?) New thread to prevent "Cannot start a runtime from within a runtime."
|
|
||||||
// when a call to a component fails / panics
|
|
||||||
// std::thread::spawn(move || {
|
|
||||||
// futures::executor::block_on(async move {
|
|
||||||
for decoder_path in decoder_paths {
|
|
||||||
if let Err(error) = add_decoder(&decoder_path).await {
|
|
||||||
eprintln!("add_decoders error: {error:?}");
|
|
||||||
} else {
|
|
||||||
added_decoders_count += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// })
|
|
||||||
// }).join().unwrap();
|
|
||||||
|
|
||||||
added_decoders_count
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn add_decoder(path: &str) -> wasmtime::Result<()> {
|
|
||||||
let wasmtime_component = WasmtimeComponent::from_file(&ENGINE, path)?;
|
|
||||||
|
|
||||||
let mut store_lock = STORE.lock().await;
|
|
||||||
let mut store = store_lock.as_context_mut();
|
|
||||||
|
|
||||||
let component = Component::instantiate(&mut store, &wasmtime_component, &LINKER)?;
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"Decoder name: {}",
|
|
||||||
component
|
|
||||||
.component_decoder_decoder()
|
|
||||||
.call_name(&mut store)?
|
|
||||||
);
|
|
||||||
component
|
|
||||||
.component_decoder_decoder()
|
|
||||||
.call_init(&mut store)?;
|
|
||||||
|
|
||||||
DECODERS.write().await.push(component);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
125
src-tauri/src/component_manager/decoders.rs
Normal file
125
src-tauri/src/component_manager/decoders.rs
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
use crate::{AddedDecodersCount, DecoderPath, RemovedDecodersCount};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use tauri::async_runtime::{Mutex, RwLock};
|
||||||
|
use wasmtime::component::{Component as WasmtimeComponent, *};
|
||||||
|
use wasmtime::{AsContextMut, Engine, Store};
|
||||||
|
use wasmtime_wasi::{WasiCtx, WasiView};
|
||||||
|
|
||||||
|
bindgen!(in "wit/decoder");
|
||||||
|
|
||||||
|
pub static DECODERS: Lazy<Arc<RwLock<Vec<Component>>>> = Lazy::new(<_>::default);
|
||||||
|
static ENGINE: Lazy<Engine> = Lazy::new(<_>::default);
|
||||||
|
static LINKER: Lazy<Linker<State>> = Lazy::new(|| {
|
||||||
|
let mut linker = Linker::new(&ENGINE);
|
||||||
|
wasmtime_wasi::add_to_linker_sync(&mut linker).unwrap();
|
||||||
|
Component::add_to_linker(&mut linker, |state: &mut State| state).unwrap();
|
||||||
|
linker
|
||||||
|
});
|
||||||
|
pub static STORE: Lazy<Arc<Mutex<Store<State>>>> = Lazy::new(|| {
|
||||||
|
let store = Store::new(
|
||||||
|
&ENGINE,
|
||||||
|
State {
|
||||||
|
ctx: WasiCtx::builder().build(),
|
||||||
|
table: ResourceTable::new(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
Arc::new(Mutex::new(store))
|
||||||
|
});
|
||||||
|
|
||||||
|
pub struct State {
|
||||||
|
ctx: WasiCtx,
|
||||||
|
table: ResourceTable,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WasiView for State {
|
||||||
|
fn ctx(&mut self) -> &mut WasiCtx {
|
||||||
|
&mut self.ctx
|
||||||
|
}
|
||||||
|
fn table(&mut self) -> &mut ResourceTable {
|
||||||
|
&mut self.table
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl component::decoder::host::Host for State {
|
||||||
|
fn log(&mut self, message: String) {
|
||||||
|
println!("Decoder: {message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn remove_all_decoders() -> RemovedDecodersCount {
|
||||||
|
let mut decoders = DECODERS.write().await;
|
||||||
|
let decoders_count = decoders.len();
|
||||||
|
decoders.clear();
|
||||||
|
decoders_count
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO Make println work on Windows in release mode?
|
||||||
|
// https://github.com/tauri-apps/tauri/discussions/8626
|
||||||
|
|
||||||
|
// @TODO Remove / improve comments below
|
||||||
|
// Testing
|
||||||
|
//
|
||||||
|
// Rust
|
||||||
|
// FW.add_decoders(["../test_files/components/rust_decoder/rust_decoder.wasm"])
|
||||||
|
// FW.add_decoders(["../test_files/components/rust_decoder/rust_decoder.wasm", "../test_files/components/rust_decoder/rust_decoder.wasm"])
|
||||||
|
//
|
||||||
|
// JS
|
||||||
|
// FW.add_decoders(["../test_files/components/javascript_decoder/javascript_decoder.wasm"])
|
||||||
|
//
|
||||||
|
// Python
|
||||||
|
// FW.add_decoders(["../test_files/components/python_decoder/python_decoder.wasm"])
|
||||||
|
//
|
||||||
|
// Remove all
|
||||||
|
// FW.remove_all_decoders()
|
||||||
|
//
|
||||||
|
// All Debug
|
||||||
|
// FW.add_decoders(["../test_files/components/rust_decoder/rust_decoder.wasm", "../test_files/components/javascript_decoder/javascript_decoder.wasm", "../test_files/components/python_decoder/python_decoder.wasm"])
|
||||||
|
//
|
||||||
|
// All Release
|
||||||
|
// FW.add_decoders(["../../test_files/components/rust_decoder/rust_decoder.wasm", "../../test_files/components/javascript_decoder/javascript_decoder.wasm", "../../test_files/components/python_decoder/python_decoder.wasm"])
|
||||||
|
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {
|
||||||
|
println!("Decoders: {decoder_paths:#?}");
|
||||||
|
println!("Current dir: {:#?}", std::env::current_dir().unwrap());
|
||||||
|
|
||||||
|
let mut added_decoders_count = 0;
|
||||||
|
|
||||||
|
// @TODO (?) New thread to prevent "Cannot start a runtime from within a runtime."
|
||||||
|
// when a call to a component fails / panics
|
||||||
|
// std::thread::spawn(move || {
|
||||||
|
// futures::executor::block_on(async move {
|
||||||
|
for decoder_path in decoder_paths {
|
||||||
|
if let Err(error) = add_decoder(&decoder_path).await {
|
||||||
|
eprintln!("add_decoders error: {error:?}");
|
||||||
|
} else {
|
||||||
|
added_decoders_count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// })
|
||||||
|
// }).join().unwrap();
|
||||||
|
|
||||||
|
added_decoders_count
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn add_decoder(path: &str) -> wasmtime::Result<()> {
|
||||||
|
let wasmtime_component = WasmtimeComponent::from_file(&ENGINE, path)?;
|
||||||
|
|
||||||
|
let mut store_lock = STORE.lock().await;
|
||||||
|
let mut store = store_lock.as_context_mut();
|
||||||
|
|
||||||
|
let component = Component::instantiate(&mut store, &wasmtime_component, &LINKER)?;
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"Decoder name: {}",
|
||||||
|
component
|
||||||
|
.component_decoder_decoder()
|
||||||
|
.call_name(&mut store)?
|
||||||
|
);
|
||||||
|
component
|
||||||
|
.component_decoder_decoder()
|
||||||
|
.call_init(&mut store)?;
|
||||||
|
|
||||||
|
DECODERS.write().await.push(component);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
273
src-tauri/src/component_manager/diagram_connectors.rs
Normal file
273
src-tauri/src/component_manager/diagram_connectors.rs
Normal file
|
@ -0,0 +1,273 @@
|
||||||
|
use crate::{
|
||||||
|
AddedDiagramConnectorsCount, ComponentId, DiagramConnectorName, DiagramConnectorPath,
|
||||||
|
RemovedDiagramConnectorsCount, APP_HANDLE, WAVEFORM,
|
||||||
|
};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
use shared::{DiagramConnectorMessage, VarFormat};
|
||||||
|
use std::sync::Arc;
|
||||||
|
use tauri::async_runtime::{Mutex, RwLock};
|
||||||
|
use tauri::Manager;
|
||||||
|
use wasmtime::component::{Component as WasmtimeComponent, *};
|
||||||
|
use wasmtime::{AsContextMut, Engine, Store};
|
||||||
|
use wasmtime_wasi::{WasiCtx, WasiView};
|
||||||
|
use wellen::GetItem;
|
||||||
|
|
||||||
|
bindgen!(in "wit/diagram_connector");
|
||||||
|
|
||||||
|
pub static DIAGRAM_CONNECTORS: Lazy<Arc<RwLock<Vec<Component>>>> = Lazy::new(<_>::default);
|
||||||
|
static ENGINE: Lazy<Engine> = Lazy::new(<_>::default);
|
||||||
|
static LINKER: Lazy<Linker<State>> = Lazy::new(|| {
|
||||||
|
let mut linker = Linker::new(&ENGINE);
|
||||||
|
wasmtime_wasi::add_to_linker_sync(&mut linker).unwrap();
|
||||||
|
Component::add_to_linker(&mut linker, |state: &mut State| state).unwrap();
|
||||||
|
linker
|
||||||
|
});
|
||||||
|
pub static STORE: Lazy<Arc<Mutex<Store<State>>>> = Lazy::new(|| {
|
||||||
|
let store = Store::new(
|
||||||
|
&ENGINE,
|
||||||
|
State {
|
||||||
|
ctx: WasiCtx::builder().build(),
|
||||||
|
table: ResourceTable::new(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
Arc::new(Mutex::new(store))
|
||||||
|
});
|
||||||
|
|
||||||
|
pub struct State {
|
||||||
|
ctx: WasiCtx,
|
||||||
|
table: ResourceTable,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WasiView for State {
|
||||||
|
fn ctx(&mut self) -> &mut WasiCtx {
|
||||||
|
&mut self.ctx
|
||||||
|
}
|
||||||
|
fn table(&mut self) -> &mut ResourceTable {
|
||||||
|
&mut self.table
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl component::diagram_connector::host::Host for State {
|
||||||
|
fn log(&mut self, message: String) {
|
||||||
|
println!("Diagram Connector: {message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn listen_for_component_text_changes(
|
||||||
|
&mut self,
|
||||||
|
diagram_connector_name: String,
|
||||||
|
component_id: String,
|
||||||
|
) {
|
||||||
|
let message = DiagramConnectorMessage::ListenForComponentTextChanges {
|
||||||
|
diagram_connector_name,
|
||||||
|
component_id,
|
||||||
|
};
|
||||||
|
APP_HANDLE
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.emit("diagram_connector_message", message)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_component_text(&mut self, component_id: String, text: String) {
|
||||||
|
let message = DiagramConnectorMessage::SetComponentText { component_id, text };
|
||||||
|
APP_HANDLE
|
||||||
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.as_ref()
|
||||||
|
.unwrap()
|
||||||
|
.emit("diagram_connector_message", message)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO `resource` in WIT or async in the future
|
||||||
|
// @TODO move business logic to the diagram connector
|
||||||
|
fn address_and_way(&mut self, time_text: String) -> Result<(String, Option<u32>), ()> {
|
||||||
|
let input_time = time_text.parse::<u64>().map_err(|error| {
|
||||||
|
eprintln!("Failed to parse time_text '{time_text}', error: {error:#}");
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let waveform_wrapper = WAVEFORM.read().unwrap();
|
||||||
|
let mut maybe_waveform = waveform_wrapper.try_write().unwrap();
|
||||||
|
let waveform = maybe_waveform.as_mut().unwrap();
|
||||||
|
|
||||||
|
let hierarchy = waveform.hierarchy();
|
||||||
|
|
||||||
|
// @TODO remove
|
||||||
|
// let timescale = hierarchy.timescale().unwrap();
|
||||||
|
// println!("Timescale: {timescale:#?}");
|
||||||
|
|
||||||
|
let refill_valid_ref = hierarchy
|
||||||
|
.lookup_var(
|
||||||
|
&["TOP", "VexiiRiscv"],
|
||||||
|
&"FetchL1Plugin_logic_refill_start_valid",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let refill_address_ref = hierarchy
|
||||||
|
.lookup_var(
|
||||||
|
&["TOP", "VexiiRiscv"],
|
||||||
|
&"FetchL1Plugin_logic_refill_start_address",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let refill_way_ref = hierarchy
|
||||||
|
.lookup_var(
|
||||||
|
&["TOP", "VexiiRiscv"],
|
||||||
|
&"FetchL1Plugin_logic_refill_start_wayToAllocate",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let refill_valid_var = hierarchy.get(refill_valid_ref);
|
||||||
|
let refill_address_var = hierarchy.get(refill_address_ref);
|
||||||
|
let refill_way_var = hierarchy.get(refill_way_ref);
|
||||||
|
|
||||||
|
let refill_valid_signal_ref = refill_valid_var.signal_ref();
|
||||||
|
let refill_address_signal_ref = refill_address_var.signal_ref();
|
||||||
|
let refill_way_signal_ref = refill_way_var.signal_ref();
|
||||||
|
|
||||||
|
let mut time_table_idx = None;
|
||||||
|
for (idx, time) in waveform.time_table().iter().enumerate() {
|
||||||
|
if *time >= input_time {
|
||||||
|
time_table_idx = Some(idx as u32);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let Some(time_table_idx) = time_table_idx else {
|
||||||
|
eprintln!("time_table_idx is None");
|
||||||
|
Err(())?
|
||||||
|
};
|
||||||
|
|
||||||
|
waveform.load_signals_multi_threaded(&[
|
||||||
|
refill_valid_signal_ref,
|
||||||
|
refill_address_signal_ref,
|
||||||
|
refill_way_signal_ref,
|
||||||
|
]);
|
||||||
|
|
||||||
|
let refill_valid_signal = waveform.get_signal(refill_valid_signal_ref).unwrap();
|
||||||
|
let refill_valid_offset = refill_valid_signal.get_offset(time_table_idx).unwrap();
|
||||||
|
let refill_valid_value = refill_valid_signal
|
||||||
|
.get_value_at(&refill_valid_offset, 0)
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
let refill_address_signal = waveform.get_signal(refill_address_signal_ref).unwrap();
|
||||||
|
let refill_address_offset = refill_address_signal.get_offset(time_table_idx).unwrap();
|
||||||
|
let refill_address_value = refill_address_signal.get_value_at(&refill_address_offset, 0);
|
||||||
|
let refill_address_value = VarFormat::Hexadecimal.format(refill_address_value);
|
||||||
|
|
||||||
|
if refill_valid_value == "0" {
|
||||||
|
return Ok((refill_address_value, None));
|
||||||
|
}
|
||||||
|
|
||||||
|
let refill_way_signal = waveform.get_signal(refill_way_signal_ref).unwrap();
|
||||||
|
let refill_way_offset = refill_way_signal.get_offset(time_table_idx).unwrap();
|
||||||
|
let refill_way_value = refill_way_signal.get_value_at(&refill_way_offset, 0);
|
||||||
|
let refill_way_value = VarFormat::Unsigned.format(refill_way_value);
|
||||||
|
|
||||||
|
Ok((
|
||||||
|
refill_address_value,
|
||||||
|
Some(refill_way_value.parse().unwrap()),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn remove_all_diagram_connectors() -> RemovedDiagramConnectorsCount {
|
||||||
|
let mut diagram_connectors = DIAGRAM_CONNECTORS.write().await;
|
||||||
|
let diagram_connectors_count = diagram_connectors.len();
|
||||||
|
diagram_connectors.clear();
|
||||||
|
diagram_connectors_count
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO Make println work on Windows in release mode?
|
||||||
|
// https://github.com/tauri-apps/tauri/discussions/8626
|
||||||
|
|
||||||
|
// @TODO Remove / improve comments below
|
||||||
|
// Testing
|
||||||
|
//
|
||||||
|
// Rust
|
||||||
|
// FW.add_diagram_connectors(["../test_files/components/rust_diagram_connector/rust_diagram_connector.wasm"])
|
||||||
|
//
|
||||||
|
// Remove all
|
||||||
|
// FW.remove_all_diagram_connectors()
|
||||||
|
//
|
||||||
|
// All Debug
|
||||||
|
// FW.add_diagram_connectors(["../test_files/components/rust_diagram_connector/rust_diagram_connector.wasm"])
|
||||||
|
//
|
||||||
|
// All Release
|
||||||
|
// FW.add_diagram_connectors(["../../test_files/components/rust_diagram_connector/rust_diagram_connector.wasm"])
|
||||||
|
pub async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<DiagramConnectorPath>,
|
||||||
|
) -> AddedDiagramConnectorsCount {
|
||||||
|
println!("Diagram Connectors: {diagram_connector_paths:#?}");
|
||||||
|
println!("Current dir: {:#?}", std::env::current_dir().unwrap());
|
||||||
|
|
||||||
|
let mut added_diagram_connectors_count = 0;
|
||||||
|
|
||||||
|
// @TODO (?) New thread to prevent "Cannot start a runtime from within a runtime."
|
||||||
|
// when a call to a component fails / panics
|
||||||
|
// std::thread::spawn(move || {
|
||||||
|
// futures::executor::block_on(async move {
|
||||||
|
for diagram_connector_path in diagram_connector_paths {
|
||||||
|
if let Err(error) = add_diagram_connector(&diagram_connector_path).await {
|
||||||
|
eprintln!("add_diagram_connectors error: {error:?}");
|
||||||
|
} else {
|
||||||
|
added_diagram_connectors_count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// })
|
||||||
|
// }).join().unwrap();
|
||||||
|
|
||||||
|
added_diagram_connectors_count
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn add_diagram_connector(path: &str) -> wasmtime::Result<()> {
|
||||||
|
let wasmtime_component = WasmtimeComponent::from_file(&ENGINE, path)?;
|
||||||
|
|
||||||
|
let mut store_lock = STORE.lock().await;
|
||||||
|
let mut store = store_lock.as_context_mut();
|
||||||
|
|
||||||
|
let component = Component::instantiate(&mut store, &wasmtime_component, &LINKER)?;
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"Diagram Connector name: {}",
|
||||||
|
component
|
||||||
|
.component_diagram_connector_diagram_connector()
|
||||||
|
.call_name(&mut store)?
|
||||||
|
);
|
||||||
|
component
|
||||||
|
.component_diagram_connector_diagram_connector()
|
||||||
|
.call_init(&mut store)?;
|
||||||
|
|
||||||
|
DIAGRAM_CONNECTORS.write().await.push(component);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO rename `ComponentId` everywhere to something like `DiagramElementId`?
|
||||||
|
// @TODO get rid of unwraps
|
||||||
|
pub async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: DiagramConnectorName,
|
||||||
|
component_id: ComponentId,
|
||||||
|
text: String,
|
||||||
|
) {
|
||||||
|
let mut store_lock = STORE.lock().await;
|
||||||
|
let mut store = store_lock.as_context_mut();
|
||||||
|
|
||||||
|
let diagram_connectors = DIAGRAM_CONNECTORS.read().await;
|
||||||
|
|
||||||
|
// @TODO store diagram_collectors in a hashmap/btreemap?
|
||||||
|
let diagram_connector = diagram_connectors
|
||||||
|
.iter()
|
||||||
|
.find(|diagram_collector| {
|
||||||
|
let name = diagram_collector
|
||||||
|
.component_diagram_connector_diagram_connector()
|
||||||
|
.call_name(&mut store)
|
||||||
|
.unwrap();
|
||||||
|
name == diagram_connector
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
diagram_connector
|
||||||
|
.component_diagram_connector_diagram_connector()
|
||||||
|
.call_on_component_text_changed(&mut store, &component_id, &text)
|
||||||
|
.unwrap();
|
||||||
|
}
|
|
@ -1,20 +1,34 @@
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use tauri::async_runtime::RwLock;
|
use std::process::Command;
|
||||||
|
use std::sync::{Arc, RwLock as StdRwLock};
|
||||||
|
use std::time::Duration;
|
||||||
|
use tauri::{async_runtime::RwLock, AppHandle};
|
||||||
use tauri_plugin_dialog::DialogExt;
|
use tauri_plugin_dialog::DialogExt;
|
||||||
use wasmtime::AsContextMut;
|
use wasmtime::AsContextMut;
|
||||||
use wellen::simple::Waveform;
|
use wellen::simple::Waveform;
|
||||||
|
|
||||||
type Filename = String;
|
type Filename = String;
|
||||||
type JavascriptCode = String;
|
type JavascriptCode = String;
|
||||||
|
|
||||||
type AddedDecodersCount = usize;
|
type AddedDecodersCount = usize;
|
||||||
type RemovedDecodersCount = usize;
|
type RemovedDecodersCount = usize;
|
||||||
type DecoderPath = String;
|
type DecoderPath = String;
|
||||||
|
|
||||||
|
type AddedDiagramConnectorsCount = usize;
|
||||||
|
type RemovedDiagramConnectorsCount = usize;
|
||||||
|
type DiagramConnectorPath = String;
|
||||||
|
type DiagramConnectorName = String;
|
||||||
|
type ComponentId = String;
|
||||||
|
|
||||||
mod component_manager;
|
mod component_manager;
|
||||||
|
|
||||||
|
pub static APP_HANDLE: Lazy<Arc<StdRwLock<Option<AppHandle>>>> = Lazy::new(<_>::default);
|
||||||
|
pub static WAVEFORM: Lazy<StdRwLock<Arc<RwLock<Option<Waveform>>>>> = Lazy::new(<_>::default);
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Store {
|
struct Store {
|
||||||
waveform: RwLock<Option<Waveform>>,
|
waveform: Arc<RwLock<Option<Waveform>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command(rename_all = "snake_case")]
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
@ -37,6 +51,7 @@ async fn pick_and_load_waveform(
|
||||||
panic!("Waveform file reading failed")
|
panic!("Waveform file reading failed")
|
||||||
};
|
};
|
||||||
*store.waveform.write().await = Some(waveform);
|
*store.waveform.write().await = Some(waveform);
|
||||||
|
*WAVEFORM.write().unwrap() = Arc::clone(&store.waveform);
|
||||||
Ok(Some(file_response.name.unwrap()))
|
Ok(Some(file_response.name.unwrap()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +107,8 @@ async fn load_signal_and_get_timeline(
|
||||||
// @TODO Workaround? Is it a problem only for non-Rust components? Is it needed only when there is a problem in the component (e.g. "`Err` value: wasm trap: cannot enter component instance"?)
|
// @TODO Workaround? Is it a problem only for non-Rust components? Is it needed only when there is a problem in the component (e.g. "`Err` value: wasm trap: cannot enter component instance"?)
|
||||||
// let value = std::thread::spawn(move || {
|
// let value = std::thread::spawn(move || {
|
||||||
// futures::executor::block_on(async move {
|
// futures::executor::block_on(async move {
|
||||||
let decoders = component_manager::DECODERS.read().await;
|
let decoders = component_manager::decoders::DECODERS.read().await;
|
||||||
let mut store_lock = component_manager::STORE.lock().await;
|
let mut store_lock = component_manager::decoders::STORE.lock().await;
|
||||||
let mut store = store_lock.as_context_mut();
|
let mut store = store_lock.as_context_mut();
|
||||||
|
|
||||||
for decoder in decoders.iter() {
|
for decoder in decoders.iter() {
|
||||||
|
@ -127,12 +142,97 @@ async fn unload_signal(signal_ref_index: usize, store: tauri::State<'_, Store>)
|
||||||
|
|
||||||
#[tauri::command(rename_all = "snake_case")]
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> Result<AddedDecodersCount, ()> {
|
async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> Result<AddedDecodersCount, ()> {
|
||||||
Ok(component_manager::add_decoders(decoder_paths).await)
|
Ok(component_manager::decoders::add_decoders(decoder_paths).await)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command(rename_all = "snake_case")]
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
async fn remove_all_decoders() -> Result<RemovedDecodersCount, ()> {
|
async fn remove_all_decoders() -> Result<RemovedDecodersCount, ()> {
|
||||||
Ok(component_manager::remove_all_decoders().await)
|
Ok(component_manager::decoders::remove_all_decoders().await)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<DiagramConnectorPath>,
|
||||||
|
) -> Result<AddedDiagramConnectorsCount, ()> {
|
||||||
|
Ok(
|
||||||
|
component_manager::diagram_connectors::add_diagram_connectors(diagram_connector_paths)
|
||||||
|
.await,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
async fn remove_all_diagram_connectors() -> Result<RemovedDiagramConnectorsCount, ()> {
|
||||||
|
Ok(component_manager::diagram_connectors::remove_all_diagram_connectors().await)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: DiagramConnectorName,
|
||||||
|
component_id: ComponentId,
|
||||||
|
text: String,
|
||||||
|
) -> Result<(), ()> {
|
||||||
|
Ok(
|
||||||
|
component_manager::diagram_connectors::notify_diagram_connector_text_change(
|
||||||
|
diagram_connector,
|
||||||
|
component_id,
|
||||||
|
text,
|
||||||
|
)
|
||||||
|
.await,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "snake_case")]
|
||||||
|
async fn open_konata_file(app: tauri::AppHandle) {
|
||||||
|
let Some(file_response) = app.dialog().file().blocking_pick_file() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let file_path = file_response.path.into_os_string().into_string().unwrap();
|
||||||
|
|
||||||
|
spawn_konata_app();
|
||||||
|
|
||||||
|
let port = 30000;
|
||||||
|
let base_url = format!("http://localhost:{port}");
|
||||||
|
let client = reqwest::Client::builder()
|
||||||
|
.timeout(Duration::from_secs(30))
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
if client
|
||||||
|
.get(format!("{base_url}/status"))
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.is_ok()
|
||||||
|
{
|
||||||
|
client
|
||||||
|
.post(format!("{base_url}/open-konata-file"))
|
||||||
|
.json(&serde_json::json!({
|
||||||
|
"file_path": file_path
|
||||||
|
}))
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.unwrap()
|
||||||
|
.error_for_status()
|
||||||
|
.unwrap();
|
||||||
|
} else {
|
||||||
|
println!("Failed to get Konata server status");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_family = "windows")]
|
||||||
|
fn spawn_konata_app() {
|
||||||
|
Command::new("cscript")
|
||||||
|
.current_dir("../../konata")
|
||||||
|
.arg("konata.vbs")
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
fn spawn_konata_app() {
|
||||||
|
Command::new("sh")
|
||||||
|
.current_dir("../../konata")
|
||||||
|
.arg("konata.sh")
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
|
@ -145,7 +245,7 @@ pub fn run() {
|
||||||
.manage(Store::default())
|
.manage(Store::default())
|
||||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||||
.plugin(tauri_plugin_dialog::init())
|
.plugin(tauri_plugin_dialog::init())
|
||||||
// Npte: Add all handlers to `frontend/src/tauri_bridge.rs`
|
// Note: Add all handlers to `frontend/src/tauri_bridge.rs`
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
show_window,
|
show_window,
|
||||||
pick_and_load_waveform,
|
pick_and_load_waveform,
|
||||||
|
@ -155,7 +255,15 @@ pub fn run() {
|
||||||
unload_signal,
|
unload_signal,
|
||||||
add_decoders,
|
add_decoders,
|
||||||
remove_all_decoders,
|
remove_all_decoders,
|
||||||
|
add_diagram_connectors,
|
||||||
|
remove_all_diagram_connectors,
|
||||||
|
notify_diagram_connector_text_change,
|
||||||
|
open_konata_file,
|
||||||
])
|
])
|
||||||
|
.setup(|app| {
|
||||||
|
*APP_HANDLE.write().unwrap() = Some(app.handle().to_owned());
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|
19
src-tauri/wit/diagram_connector/world.wit
Normal file
19
src-tauri/wit/diagram_connector/world.wit
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package component:diagram-connector;
|
||||||
|
|
||||||
|
interface host {
|
||||||
|
log: func(message: string);
|
||||||
|
listen-for-component-text-changes: func(diagram-connect-name: string, component-id: string);
|
||||||
|
set-component-text: func(component-id: string, text: string);
|
||||||
|
address-and-way: func(time-text: string) -> result<tuple<string, option<u32>>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface diagram-connector {
|
||||||
|
init: func();
|
||||||
|
name: func() -> string;
|
||||||
|
on-component-text-changed: func(component-id: string, text: string);
|
||||||
|
}
|
||||||
|
|
||||||
|
world component {
|
||||||
|
import host;
|
||||||
|
export diagram-connector;
|
||||||
|
}
|
1
test_files/.gitignore
vendored
Normal file
1
test_files/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
sv39_mmu_cache_sim/
|
431
test_files/cache_diagram.excalidraw
Normal file
431
test_files/cache_diagram.excalidraw
Normal file
|
@ -0,0 +1,431 @@
|
||||||
|
{
|
||||||
|
"type": "excalidraw",
|
||||||
|
"version": 2,
|
||||||
|
"source": "http://localhost:8080",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"version": 174,
|
||||||
|
"versionNonce": 1552336377,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "xPhIioz8O3Vjc7QcLfYes",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 60,
|
||||||
|
"y": 120,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 1153.125,
|
||||||
|
"height": 57.599999999999994,
|
||||||
|
"seed": 1317703821,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": null,
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732565113996,
|
||||||
|
"link": null,
|
||||||
|
"locked": false,
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": 3,
|
||||||
|
"text": "1. Extract 'test_files/sv39_mmu_cache_sim.zip' to 'test_files/sv39_mmu_cache_sim'\n2. Load file 'test_files/sv39_mmu_cache_sim/fst/wave.fst'\n3. Run command 'FW.add_diagram_connectors([\"../test_files/components/rust_diagram_connector/rust_diagram_connector.wasm\"])'",
|
||||||
|
"textAlign": "left",
|
||||||
|
"verticalAlign": "top",
|
||||||
|
"containerId": null,
|
||||||
|
"originalText": "1. Extract 'test_files/sv39_mmu_cache_sim.zip' to 'test_files/sv39_mmu_cache_sim'\n2. Load file 'test_files/sv39_mmu_cache_sim/fst/wave.fst'\n3. Run command 'FW.add_diagram_connectors([\"../test_files/components/rust_diagram_connector/rust_diagram_connector.wasm\"])'",
|
||||||
|
"lineHeight": 1.2,
|
||||||
|
"baseline": 54
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "rectangle",
|
||||||
|
"version": 133,
|
||||||
|
"versionNonce": 631769070,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "WORIbkpEkf5c85sK8DhU-",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 4,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 460,
|
||||||
|
"y": 220,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "#a5d8ff",
|
||||||
|
"width": 300,
|
||||||
|
"height": 440.00000000000006,
|
||||||
|
"seed": 1957721512,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": {
|
||||||
|
"type": 3
|
||||||
|
},
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732565668461,
|
||||||
|
"link": null,
|
||||||
|
"locked": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"version": 90,
|
||||||
|
"versionNonce": 1920851711,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "mBGA6gGm1aDhGnBNB8gPz",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 541.5560073852539,
|
||||||
|
"y": 260,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 144.50794982910156,
|
||||||
|
"height": 35,
|
||||||
|
"seed": 1040757672,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": null,
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732566083274,
|
||||||
|
"link": null,
|
||||||
|
"locked": false,
|
||||||
|
"fontSize": 28,
|
||||||
|
"fontFamily": 1,
|
||||||
|
"text": "SV39 MMU",
|
||||||
|
"textAlign": "center",
|
||||||
|
"verticalAlign": "top",
|
||||||
|
"containerId": null,
|
||||||
|
"originalText": "SV39 MMU",
|
||||||
|
"lineHeight": 1.25,
|
||||||
|
"baseline": 24
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"version": 153,
|
||||||
|
"versionNonce": 302406585,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "8eNVs3Eiiy6Ns1KqVK-zj",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 480,
|
||||||
|
"y": 440,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 73.369140625,
|
||||||
|
"height": 23,
|
||||||
|
"seed": 1170025128,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": null,
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732565113996,
|
||||||
|
"link": null,
|
||||||
|
"locked": false,
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": 2,
|
||||||
|
"text": "Address",
|
||||||
|
"textAlign": "left",
|
||||||
|
"verticalAlign": "top",
|
||||||
|
"containerId": null,
|
||||||
|
"originalText": "Address",
|
||||||
|
"lineHeight": 1.15,
|
||||||
|
"baseline": 18
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "rectangle",
|
||||||
|
"version": 116,
|
||||||
|
"versionNonce": 57845422,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "IhK6hwJEwdKZ9bG8aTkN7",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 480,
|
||||||
|
"y": 473.5732012743411,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 260,
|
||||||
|
"height": 40,
|
||||||
|
"seed": 590079912,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": {
|
||||||
|
"type": 3
|
||||||
|
},
|
||||||
|
"boundElements": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"id": "ITxhJ7NtZ74YFd9JQ0_pl"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"updated": 1732565668739,
|
||||||
|
"link": null,
|
||||||
|
"locked": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"version": 37,
|
||||||
|
"versionNonce": 761868063,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "ITxhJ7NtZ74YFd9JQ0_pl",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 486.953125,
|
||||||
|
"y": 481.5732012743411,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 246.09375,
|
||||||
|
"height": 24,
|
||||||
|
"seed": 684450162,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": null,
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732566156524,
|
||||||
|
"link": null,
|
||||||
|
"locked": false,
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": 3,
|
||||||
|
"text": " UNKNOWN ",
|
||||||
|
"textAlign": "center",
|
||||||
|
"verticalAlign": "middle",
|
||||||
|
"containerId": "IhK6hwJEwdKZ9bG8aTkN7",
|
||||||
|
"originalText": " UNKNOWN ",
|
||||||
|
"lineHeight": 1.2,
|
||||||
|
"baseline": 19
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"version": 301,
|
||||||
|
"versionNonce": 873757849,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "Lcp_kf4ZNFv0MtP5S6q91",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 480,
|
||||||
|
"y": 554.9486030561815,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 56.69921875,
|
||||||
|
"height": 23,
|
||||||
|
"seed": 1685601960,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": null,
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732565113996,
|
||||||
|
"link": null,
|
||||||
|
"locked": false,
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": 2,
|
||||||
|
"text": "Status",
|
||||||
|
"textAlign": "left",
|
||||||
|
"verticalAlign": "top",
|
||||||
|
"containerId": null,
|
||||||
|
"originalText": "Status",
|
||||||
|
"lineHeight": 1.15,
|
||||||
|
"baseline": 18
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"version": 148,
|
||||||
|
"versionNonce": 586282359,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "cHL582ZJrMvSgzJTCSVQg",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 480,
|
||||||
|
"y": 320,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 83.701171875,
|
||||||
|
"height": 23,
|
||||||
|
"seed": 1428509096,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": null,
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732565113996,
|
||||||
|
"link": null,
|
||||||
|
"locked": false,
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": 2,
|
||||||
|
"text": "Time (ps)",
|
||||||
|
"textAlign": "left",
|
||||||
|
"verticalAlign": "top",
|
||||||
|
"containerId": null,
|
||||||
|
"originalText": "Time (ps)",
|
||||||
|
"lineHeight": 1.15,
|
||||||
|
"baseline": 18
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "rectangle",
|
||||||
|
"version": 160,
|
||||||
|
"versionNonce": 896237945,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "KsSzJicTZlMzyYamex99O",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 480,
|
||||||
|
"y": 352,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "#ffffff",
|
||||||
|
"width": 260,
|
||||||
|
"height": 40,
|
||||||
|
"seed": 825642664,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": {
|
||||||
|
"type": 3
|
||||||
|
},
|
||||||
|
"boundElements": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"id": "afXu8_6Kqfq-q2IsjtAcP"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"updated": 1732565113996,
|
||||||
|
"link": null,
|
||||||
|
"locked": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"version": 170,
|
||||||
|
"versionNonce": 1243754135,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "afXu8_6Kqfq-q2IsjtAcP",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 485,
|
||||||
|
"y": 360,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 46.875,
|
||||||
|
"height": 24,
|
||||||
|
"seed": 902183336,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": null,
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732565113996,
|
||||||
|
"link": null,
|
||||||
|
"locked": false,
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": 3,
|
||||||
|
"text": "3125",
|
||||||
|
"textAlign": "left",
|
||||||
|
"verticalAlign": "middle",
|
||||||
|
"containerId": "KsSzJicTZlMzyYamex99O",
|
||||||
|
"originalText": "3125",
|
||||||
|
"lineHeight": 1.2,
|
||||||
|
"baseline": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "rectangle",
|
||||||
|
"version": 42,
|
||||||
|
"versionNonce": 55503449,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "4l74x5uAeTeBuxx_8t_QY",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 480,
|
||||||
|
"y": 584.4962525171356,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 260,
|
||||||
|
"height": 40,
|
||||||
|
"seed": 595254712,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": {
|
||||||
|
"type": 3
|
||||||
|
},
|
||||||
|
"boundElements": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"id": "0iH5yRbH4IEseV3mnof3A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"updated": 1732565113996,
|
||||||
|
"link": null,
|
||||||
|
"locked": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"version": 321,
|
||||||
|
"versionNonce": 940641777,
|
||||||
|
"isDeleted": false,
|
||||||
|
"id": "0iH5yRbH4IEseV3mnof3A",
|
||||||
|
"fillStyle": "solid",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"strokeStyle": "solid",
|
||||||
|
"roughness": 0,
|
||||||
|
"opacity": 100,
|
||||||
|
"angle": 0,
|
||||||
|
"x": 486.953125,
|
||||||
|
"y": 592.4962525171356,
|
||||||
|
"strokeColor": "#1e1e1e",
|
||||||
|
"backgroundColor": "transparent",
|
||||||
|
"width": 246.09375,
|
||||||
|
"height": 24,
|
||||||
|
"seed": 2011882973,
|
||||||
|
"groupIds": [],
|
||||||
|
"frameId": null,
|
||||||
|
"roundness": null,
|
||||||
|
"boundElements": [],
|
||||||
|
"updated": 1732566143666,
|
||||||
|
"link": null,
|
||||||
|
"locked": false,
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": 3,
|
||||||
|
"text": " UNKNOWN ",
|
||||||
|
"textAlign": "center",
|
||||||
|
"verticalAlign": "middle",
|
||||||
|
"containerId": "4l74x5uAeTeBuxx_8t_QY",
|
||||||
|
"originalText": " UNKNOWN ",
|
||||||
|
"lineHeight": 1.2,
|
||||||
|
"baseline": 19
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"appState": {
|
||||||
|
"gridSize": 20,
|
||||||
|
"viewBackgroundColor": "#f5faff"
|
||||||
|
},
|
||||||
|
"files": {}
|
||||||
|
}
|
10
test_files/components/rust_diagram_connector/.vscode/settings.json
vendored
Normal file
10
test_files/components/rust_diagram_connector/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rust-analyzer.check.overrideCommand": [
|
||||||
|
"cargo",
|
||||||
|
"component",
|
||||||
|
"check",
|
||||||
|
"--workspace",
|
||||||
|
"--all-targets",
|
||||||
|
"--message-format=json"
|
||||||
|
],
|
||||||
|
}
|
26
test_files/components/rust_diagram_connector/Cargo.toml
Normal file
26
test_files/components/rust_diagram_connector/Cargo.toml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
[package]
|
||||||
|
name = "rust_diagram_connector"
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
wit-bindgen-rt = { version = "0.26.0", features = ["bitflags"] }
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
codegen-units = 1
|
||||||
|
opt-level = "s"
|
||||||
|
debug = false
|
||||||
|
strip = true
|
||||||
|
lto = true
|
||||||
|
|
||||||
|
[package.metadata.component]
|
||||||
|
package = "component:rust-diagram-connector"
|
||||||
|
|
||||||
|
[package.metadata.component.dependencies]
|
7
test_files/components/rust_diagram_connector/README.md
Normal file
7
test_files/components/rust_diagram_connector/README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
How to create and build the Rust component:
|
||||||
|
|
||||||
|
1. `cargo install cargo-component`
|
||||||
|
2. `cargo component new rust_diagram_connector --lib`
|
||||||
|
3. `cd rust_diagram_connector`
|
||||||
|
4. Update code as needed
|
||||||
|
5. `cargo component build --release --target wasm32-unknown-unknown && cp ../../../target/wasm32-unknown-unknown/release/rust_diagram_connector.wasm .`
|
Binary file not shown.
329
test_files/components/rust_diagram_connector/src/bindings.rs
Normal file
329
test_files/components/rust_diagram_connector/src/bindings.rs
Normal file
|
@ -0,0 +1,329 @@
|
||||||
|
// Generated by `wit-bindgen` 0.25.0. DO NOT EDIT!
|
||||||
|
// Options used:
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub mod component {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub mod diagram_connector {
|
||||||
|
#[allow(dead_code, clippy::all)]
|
||||||
|
pub mod host {
|
||||||
|
#[used]
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
static __FORCE_SECTION_REF: fn() =
|
||||||
|
super::super::super::__link_custom_section_describing_imports;
|
||||||
|
use super::super::super::_rt;
|
||||||
|
#[allow(unused_unsafe, clippy::all)]
|
||||||
|
pub fn log(message: &str) {
|
||||||
|
unsafe {
|
||||||
|
let vec0 = message;
|
||||||
|
let ptr0 = vec0.as_ptr().cast::<u8>();
|
||||||
|
let len0 = vec0.len();
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
#[link(wasm_import_module = "component:diagram-connector/host")]
|
||||||
|
extern "C" {
|
||||||
|
#[link_name = "log"]
|
||||||
|
fn wit_import(_: *mut u8, _: usize);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
fn wit_import(_: *mut u8, _: usize) {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
wit_import(ptr0.cast_mut(), len0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[allow(unused_unsafe, clippy::all)]
|
||||||
|
pub fn listen_for_component_text_changes(
|
||||||
|
diagram_connect_name: &str,
|
||||||
|
component_id: &str,
|
||||||
|
) {
|
||||||
|
unsafe {
|
||||||
|
let vec0 = diagram_connect_name;
|
||||||
|
let ptr0 = vec0.as_ptr().cast::<u8>();
|
||||||
|
let len0 = vec0.len();
|
||||||
|
let vec1 = component_id;
|
||||||
|
let ptr1 = vec1.as_ptr().cast::<u8>();
|
||||||
|
let len1 = vec1.len();
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
#[link(wasm_import_module = "component:diagram-connector/host")]
|
||||||
|
extern "C" {
|
||||||
|
#[link_name = "listen-for-component-text-changes"]
|
||||||
|
fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize) {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
wit_import(ptr0.cast_mut(), len0, ptr1.cast_mut(), len1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[allow(unused_unsafe, clippy::all)]
|
||||||
|
pub fn set_component_text(component_id: &str, text: &str) {
|
||||||
|
unsafe {
|
||||||
|
let vec0 = component_id;
|
||||||
|
let ptr0 = vec0.as_ptr().cast::<u8>();
|
||||||
|
let len0 = vec0.len();
|
||||||
|
let vec1 = text;
|
||||||
|
let ptr1 = vec1.as_ptr().cast::<u8>();
|
||||||
|
let len1 = vec1.len();
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
#[link(wasm_import_module = "component:diagram-connector/host")]
|
||||||
|
extern "C" {
|
||||||
|
#[link_name = "set-component-text"]
|
||||||
|
fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
fn wit_import(_: *mut u8, _: usize, _: *mut u8, _: usize) {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
wit_import(ptr0.cast_mut(), len0, ptr1.cast_mut(), len1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[allow(unused_unsafe, clippy::all)]
|
||||||
|
pub fn address_and_way(time_text: &str) -> Result<(_rt::String, Option<u32>), ()> {
|
||||||
|
unsafe {
|
||||||
|
#[repr(align(4))]
|
||||||
|
struct RetArea([::core::mem::MaybeUninit<u8>; 20]);
|
||||||
|
let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 20]);
|
||||||
|
let vec0 = time_text;
|
||||||
|
let ptr0 = vec0.as_ptr().cast::<u8>();
|
||||||
|
let len0 = vec0.len();
|
||||||
|
let ptr1 = ret_area.0.as_mut_ptr().cast::<u8>();
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
#[link(wasm_import_module = "component:diagram-connector/host")]
|
||||||
|
extern "C" {
|
||||||
|
#[link_name = "address-and-way"]
|
||||||
|
fn wit_import(_: *mut u8, _: usize, _: *mut u8);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
fn wit_import(_: *mut u8, _: usize, _: *mut u8) {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
|
wit_import(ptr0.cast_mut(), len0, ptr1);
|
||||||
|
let l2 = i32::from(*ptr1.add(0).cast::<u8>());
|
||||||
|
match l2 {
|
||||||
|
0 => {
|
||||||
|
let e = {
|
||||||
|
let l3 = *ptr1.add(4).cast::<*mut u8>();
|
||||||
|
let l4 = *ptr1.add(8).cast::<usize>();
|
||||||
|
let len5 = l4;
|
||||||
|
let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5);
|
||||||
|
let l6 = i32::from(*ptr1.add(12).cast::<u8>());
|
||||||
|
|
||||||
|
(
|
||||||
|
_rt::string_lift(bytes5),
|
||||||
|
match l6 {
|
||||||
|
0 => None,
|
||||||
|
1 => {
|
||||||
|
let e = {
|
||||||
|
let l7 = *ptr1.add(16).cast::<i32>();
|
||||||
|
|
||||||
|
l7 as u32
|
||||||
|
};
|
||||||
|
Some(e)
|
||||||
|
}
|
||||||
|
_ => _rt::invalid_enum_discriminant(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
};
|
||||||
|
Ok(e)
|
||||||
|
}
|
||||||
|
1 => {
|
||||||
|
let e = ();
|
||||||
|
Err(e)
|
||||||
|
}
|
||||||
|
_ => _rt::invalid_enum_discriminant(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub mod exports {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub mod component {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub mod diagram_connector {
|
||||||
|
#[allow(dead_code, clippy::all)]
|
||||||
|
pub mod diagram_connector {
|
||||||
|
#[used]
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
static __FORCE_SECTION_REF: fn() =
|
||||||
|
super::super::super::super::__link_custom_section_describing_imports;
|
||||||
|
use super::super::super::super::_rt;
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub unsafe fn _export_init_cabi<T: Guest>() {
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
_rt::run_ctors_once();
|
||||||
|
T::init();
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub unsafe fn _export_name_cabi<T: Guest>() -> *mut u8 {
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
_rt::run_ctors_once();
|
||||||
|
let result0 = T::name();
|
||||||
|
let ptr1 = _RET_AREA.0.as_mut_ptr().cast::<u8>();
|
||||||
|
let vec2 = (result0.into_bytes()).into_boxed_slice();
|
||||||
|
let ptr2 = vec2.as_ptr().cast::<u8>();
|
||||||
|
let len2 = vec2.len();
|
||||||
|
::core::mem::forget(vec2);
|
||||||
|
*ptr1.add(4).cast::<usize>() = len2;
|
||||||
|
*ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut();
|
||||||
|
ptr1
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub unsafe fn __post_return_name<T: Guest>(arg0: *mut u8) {
|
||||||
|
let l0 = *arg0.add(0).cast::<*mut u8>();
|
||||||
|
let l1 = *arg0.add(4).cast::<usize>();
|
||||||
|
_rt::cabi_dealloc(l0, l1, 1);
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
pub unsafe fn _export_on_component_text_changed_cabi<T: Guest>(
|
||||||
|
arg0: *mut u8,
|
||||||
|
arg1: usize,
|
||||||
|
arg2: *mut u8,
|
||||||
|
arg3: usize,
|
||||||
|
) {
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
_rt::run_ctors_once();
|
||||||
|
let len0 = arg1;
|
||||||
|
let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0);
|
||||||
|
let len1 = arg3;
|
||||||
|
let bytes1 = _rt::Vec::from_raw_parts(arg2.cast(), len1, len1);
|
||||||
|
T::on_component_text_changed(
|
||||||
|
_rt::string_lift(bytes0),
|
||||||
|
_rt::string_lift(bytes1),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
pub trait Guest {
|
||||||
|
fn init();
|
||||||
|
fn name() -> _rt::String;
|
||||||
|
fn on_component_text_changed(component_id: _rt::String, text: _rt::String);
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
|
||||||
|
macro_rules! __export_component_diagram_connector_diagram_connector_cabi{
|
||||||
|
($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = {
|
||||||
|
|
||||||
|
#[export_name = "component:diagram-connector/diagram-connector#init"]
|
||||||
|
unsafe extern "C" fn export_init() {
|
||||||
|
$($path_to_types)*::_export_init_cabi::<$ty>()
|
||||||
|
}
|
||||||
|
#[export_name = "component:diagram-connector/diagram-connector#name"]
|
||||||
|
unsafe extern "C" fn export_name() -> *mut u8 {
|
||||||
|
$($path_to_types)*::_export_name_cabi::<$ty>()
|
||||||
|
}
|
||||||
|
#[export_name = "cabi_post_component:diagram-connector/diagram-connector#name"]
|
||||||
|
unsafe extern "C" fn _post_return_name(arg0: *mut u8,) {
|
||||||
|
$($path_to_types)*::__post_return_name::<$ty>(arg0)
|
||||||
|
}
|
||||||
|
#[export_name = "component:diagram-connector/diagram-connector#on-component-text-changed"]
|
||||||
|
unsafe extern "C" fn export_on_component_text_changed(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,) {
|
||||||
|
$($path_to_types)*::_export_on_component_text_changed_cabi::<$ty>(arg0, arg1, arg2, arg3)
|
||||||
|
}
|
||||||
|
};);
|
||||||
|
}
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub(crate) use __export_component_diagram_connector_diagram_connector_cabi;
|
||||||
|
#[repr(align(4))]
|
||||||
|
struct _RetArea([::core::mem::MaybeUninit<u8>; 8]);
|
||||||
|
static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 8]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mod _rt {
|
||||||
|
pub use alloc_crate::string::String;
|
||||||
|
pub use alloc_crate::vec::Vec;
|
||||||
|
pub unsafe fn string_lift(bytes: Vec<u8>) -> String {
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
|
String::from_utf8(bytes).unwrap()
|
||||||
|
} else {
|
||||||
|
String::from_utf8_unchecked(bytes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub unsafe fn invalid_enum_discriminant<T>() -> T {
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
|
panic!("invalid enum discriminant")
|
||||||
|
} else {
|
||||||
|
core::hint::unreachable_unchecked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
pub fn run_ctors_once() {
|
||||||
|
wit_bindgen_rt::run_ctors_once();
|
||||||
|
}
|
||||||
|
pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) {
|
||||||
|
if size == 0 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let layout = alloc::Layout::from_size_align_unchecked(size, align);
|
||||||
|
alloc::dealloc(ptr as *mut u8, layout);
|
||||||
|
}
|
||||||
|
extern crate alloc as alloc_crate;
|
||||||
|
pub use alloc_crate::alloc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Generates `#[no_mangle]` functions to export the specified type as the
|
||||||
|
/// root implementation of all generated traits.
|
||||||
|
///
|
||||||
|
/// For more information see the documentation of `wit_bindgen::generate!`.
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # macro_rules! export{ ($($t:tt)*) => (); }
|
||||||
|
/// # trait Guest {}
|
||||||
|
/// struct MyType;
|
||||||
|
///
|
||||||
|
/// impl Guest for MyType {
|
||||||
|
/// // ...
|
||||||
|
/// }
|
||||||
|
///
|
||||||
|
/// export!(MyType);
|
||||||
|
/// ```
|
||||||
|
#[allow(unused_macros)]
|
||||||
|
#[doc(hidden)]
|
||||||
|
|
||||||
|
macro_rules! __export_component_impl {
|
||||||
|
($ty:ident) => (self::export!($ty with_types_in self););
|
||||||
|
($ty:ident with_types_in $($path_to_types_root:tt)*) => (
|
||||||
|
$($path_to_types_root)*::exports::component::diagram_connector::diagram_connector::__export_component_diagram_connector_diagram_connector_cabi!($ty with_types_in $($path_to_types_root)*::exports::component::diagram_connector::diagram_connector);
|
||||||
|
)
|
||||||
|
}
|
||||||
|
#[doc(inline)]
|
||||||
|
pub(crate) use __export_component_impl as export;
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
#[link_section = "component-type:wit-bindgen:0.25.0:component:encoded world"]
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 550] = *b"\
|
||||||
|
\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xa6\x03\x01A\x02\x01\
|
||||||
|
A\x04\x01B\x0b\x01@\x01\x07messages\x01\0\x04\0\x03log\x01\0\x01@\x02\x14diagram\
|
||||||
|
-connect-names\x0ccomponent-ids\x01\0\x04\0!listen-for-component-text-changes\x01\
|
||||||
|
\x01\x01@\x02\x0ccomponent-ids\x04texts\x01\0\x04\0\x12set-component-text\x01\x02\
|
||||||
|
\x01ky\x01o\x02s\x03\x01j\x01\x04\0\x01@\x01\x09time-texts\0\x05\x04\0\x0faddres\
|
||||||
|
s-and-way\x01\x06\x03\x01\x20component:diagram-connector/host\x05\0\x01B\x06\x01\
|
||||||
|
@\0\x01\0\x04\0\x04init\x01\0\x01@\0\0s\x04\0\x04name\x01\x01\x01@\x02\x0ccompon\
|
||||||
|
ent-ids\x04texts\x01\0\x04\0\x19on-component-text-changed\x01\x02\x04\x01-compon\
|
||||||
|
ent:diagram-connector/diagram-connector\x05\x01\x04\x01%component:diagram-connec\
|
||||||
|
tor/component\x04\0\x0b\x0f\x01\0\x09component\x03\0\0\0G\x09producers\x01\x0cpr\
|
||||||
|
ocessed-by\x02\x0dwit-component\x070.208.1\x10wit-bindgen-rust\x060.25.0";
|
||||||
|
|
||||||
|
#[inline(never)]
|
||||||
|
#[doc(hidden)]
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
pub fn __link_custom_section_describing_imports() {
|
||||||
|
wit_bindgen_rt::maybe_link_cabi_realloc();
|
||||||
|
}
|
63
test_files/components/rust_diagram_connector/src/lib.rs
Normal file
63
test_files/components/rust_diagram_connector/src/lib.rs
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
use std::borrow::Cow;
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
#[allow(warnings)]
|
||||||
|
mod bindings;
|
||||||
|
|
||||||
|
use bindings::component::diagram_connector::host;
|
||||||
|
use bindings::exports::component::diagram_connector::diagram_connector;
|
||||||
|
|
||||||
|
macro_rules! log {
|
||||||
|
($($arg:tt)*) => (host::log(&format!($($arg)*)))
|
||||||
|
}
|
||||||
|
|
||||||
|
static NAME: &str = "Rust Test Diagram Connector";
|
||||||
|
|
||||||
|
// Note: Ids from `test_files/cache_diagram.excalidraw`
|
||||||
|
const ADDRESS_COMPONENT_ID: &str = "ITxhJ7NtZ74YFd9JQ0_pl";
|
||||||
|
const TIME_COMPONENT_ID: &str = "afXu8_6Kqfq-q2IsjtAcP";
|
||||||
|
const STATUS_COMPONENT_ID: &str = "0iH5yRbH4IEseV3mnof3A";
|
||||||
|
|
||||||
|
thread_local! {
|
||||||
|
static TIME_TEXT: RefCell<String> = <_>::default();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Component;
|
||||||
|
|
||||||
|
impl diagram_connector::Guest for Component {
|
||||||
|
fn init() {
|
||||||
|
host::listen_for_component_text_changes(NAME, TIME_COMPONENT_ID);
|
||||||
|
log!("'{NAME}' initialized")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn name() -> String {
|
||||||
|
NAME.to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn on_component_text_changed(component_id: String, text: String) {
|
||||||
|
match component_id.as_str() {
|
||||||
|
TIME_COMPONENT_ID => {
|
||||||
|
TIME_TEXT.set(text);
|
||||||
|
refresh_fields();
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn refresh_fields() {
|
||||||
|
let way = TIME_TEXT.with_borrow(|time_text| host::address_and_way(&time_text));
|
||||||
|
let Ok((address, way)) = way else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
host::set_component_text(ADDRESS_COMPONENT_ID, &address);
|
||||||
|
|
||||||
|
let status_text: Cow<str> = if let Some(way) = way {
|
||||||
|
format!("VALID, WAY: {way}").into()
|
||||||
|
} else {
|
||||||
|
"NOT VALID".into()
|
||||||
|
};
|
||||||
|
host::set_component_text(STATUS_COMPONENT_ID, &status_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
bindings::export!(Component with_types_in bindings);
|
19
test_files/components/rust_diagram_connector/wit/world.wit
Normal file
19
test_files/components/rust_diagram_connector/wit/world.wit
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package component:diagram-connector;
|
||||||
|
|
||||||
|
interface host {
|
||||||
|
log: func(message: string);
|
||||||
|
listen-for-component-text-changes: func(diagram-connect-name: string, component-id: string);
|
||||||
|
set-component-text: func(component-id: string, text: string);
|
||||||
|
address-and-way: func(time-text: string) -> result<tuple<string, option<u32>>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface diagram-connector {
|
||||||
|
init: func();
|
||||||
|
name: func() -> string;
|
||||||
|
on-component-text-changed: func(component-id: string, text: string);
|
||||||
|
}
|
||||||
|
|
||||||
|
world component {
|
||||||
|
import host;
|
||||||
|
export diagram-connector;
|
||||||
|
}
|
BIN
test_files/sv39_mmu_cache_sim.zip
Normal file
BIN
test_files/sv39_mmu_cache_sim.zip
Normal file
Binary file not shown.
Loading…
Reference in a new issue