main.rs 554 B

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