main.rs 656 B

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