FastWave2.0/frontend/src/platform.rs
2024-06-05 01:10:14 +02:00

42 lines
1.1 KiB
Rust

// @TODO maybe rewrite `FASTWAVE_PLATFORM` to features once it's possible to set them through env vars:
// https://github.com/rust-lang/cargo/issues/4829
// NOTE: `FASTWAVE_PLATFORM` is set in `Makefile.toml` tasks and then in `build.rs`
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
mod tauri;
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
use tauri as platform;
#[cfg(FASTWAVE_PLATFORM = "BROWSER")]
mod browser;
#[cfg(FASTWAVE_PLATFORM = "BROWSER")]
use browser as platform;
type Filename = String;
pub async fn show_window() {
platform::show_window().await
}
// @TODO allow only support file types
pub async fn pick_and_load_waveform() -> Option<Filename> {
platform::pick_and_load_waveform().await
}
pub async fn get_hierarchy() -> wellen::Hierarchy {
platform::get_hierarchy().await
}
pub async fn get_time_table() -> wellen::TimeTable {
platform::get_time_table().await
}
pub async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen::Signal {
platform::load_and_get_signal(signal_ref).await
}
pub async fn unload_signal(signal_ref: wellen::SignalRef) {
platform::unload_signal(signal_ref).await
}