fix JS testing decoder
This commit is contained in:
parent
7015cc9ce6
commit
a60f4f9ec4
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -1691,6 +1691,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
|
||||||
name = "fastwave"
|
name = "fastwave"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"futures",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -1840,12 +1841,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures"
|
name = "futures"
|
||||||
version = "0.3.28"
|
version = "0.3.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
|
checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
"futures-executor",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
|
@ -1870,9 +1872,9 @@ checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-executor"
|
name = "futures-executor"
|
||||||
version = "0.3.28"
|
version = "0.3.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0"
|
checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-task",
|
"futures-task",
|
||||||
|
@ -1943,6 +1945,7 @@ version = "0.3.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
"futures-macro",
|
"futures-macro",
|
||||||
|
|
|
@ -24,6 +24,7 @@ tauri = { version = "=2.0.0-beta.22", features = ["macos-private-api", "linux-ip
|
||||||
tauri-plugin-window-state = "=2.0.0-beta.9"
|
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"
|
||||||
|
|
||||||
# wasmtime = "22.0.0"
|
# wasmtime = "22.0.0"
|
||||||
# wasmtime-wasi = "22.0.0"
|
# wasmtime-wasi = "22.0.0"
|
||||||
|
|
|
@ -79,7 +79,7 @@ pub async fn remove_all_decoders() -> RemovedDecodersCount {
|
||||||
// All Release
|
// 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"])
|
// 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 {
|
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {
|
||||||
println!("decoders in Tauri: {decoder_paths:#?}");
|
println!("Decoders: {decoder_paths:#?}");
|
||||||
println!("Current dir: {:#?}", std::env::current_dir().unwrap());
|
println!("Current dir: {:#?}", std::env::current_dir().unwrap());
|
||||||
|
|
||||||
let mut added_decoders_count = 0;
|
let mut added_decoders_count = 0;
|
||||||
|
|
|
@ -87,15 +87,27 @@ async fn load_signal_and_get_timeline(
|
||||||
var_format,
|
var_format,
|
||||||
|mut value: String| {
|
|mut value: String| {
|
||||||
Box::pin(async {
|
Box::pin(async {
|
||||||
|
// We need to spawn a (non-runtime-specific?) blocking task before calling component methods to prevent this error:
|
||||||
|
// "Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks."
|
||||||
|
// @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 || {
|
||||||
|
// futures::executor::block_on(async move {
|
||||||
let decoders = component_manager::DECODERS.read().await;
|
let decoders = component_manager::DECODERS.read().await;
|
||||||
let mut store_lock = component_manager::STORE.lock().await;
|
let mut store_lock = component_manager::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() {
|
||||||
value = decoder
|
value = decoder
|
||||||
.component_decoder_decoder()
|
.component_decoder_decoder()
|
||||||
.call_format_signal_value(&mut store, &value)
|
.call_format_signal_value(&mut store, &value)
|
||||||
|
// @TODO Resolve panic when running non-Rust components:
|
||||||
|
// `Err` value: wasm trap: cannot enter component instance
|
||||||
|
// https://github.com/bytecodealliance/wasmtime/issues/8670 ?
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
// value
|
||||||
|
// })
|
||||||
|
// }).join().unwrap();
|
||||||
value
|
value
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Binary file not shown.
|
@ -10,7 +10,7 @@ export const decoder = {
|
||||||
return name
|
return name
|
||||||
},
|
},
|
||||||
formatSignalValue(value) {
|
formatSignalValue(value) {
|
||||||
value + "!"
|
return value + "!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue