main.rs 590 B

123456789101112131415161718192021222324252627
  1. #![cfg_attr(
  2. all(not(debug_assertions), target_os = "windows"),
  3. windows_subsystem = "windows"
  4. )]
  5. mod cmd;
  6. fn main() {
  7. tauri::AppBuilder::new()
  8. .invoke_handler(|_webview, arg| {
  9. use cmd::Cmd::*;
  10. match serde_json::from_str(arg) {
  11. Err(_) => {}
  12. Ok(command) => {
  13. match command {
  14. // definitions for your custom commands from Cmd here
  15. MyCustomCommand { argument } => {
  16. // your command code
  17. println!("{}", argument);
  18. }
  19. }
  20. }
  21. }
  22. })
  23. .build()
  24. .run();
  25. }