Last active
August 15, 2023 19:32
-
-
Save YonatanKra/8309fb53e747f42a49b25c69a4fb032c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[tauri::command] | |
pub fn greet(name: &str) -> String { | |
format!("Hello, {}! You've been greeted from Rust!", name) | |
} | |
#[cfg(test)] | |
mod tests { | |
use super::*; | |
#[test] | |
fn test_greet() { | |
assert_eq!(greet("Johnny"), "Hello, Johnny! You've been greeted from Rust!"); | |
} | |
#[test] | |
fn test_greet_badly() { | |
assert_eq!(greet("Johnny"), "Hello, Bonny! You've been greeted from Rust!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | |
mod greet; | |
fn main() { | |
tauri::Builder::default() | |
.plugin(tauri_plugin_oauth::init()) | |
.invoke_handler(tauri::generate_handler![greet::greet]) | |
.run(tauri::generate_context!()) | |
.expect("error while running tauri application"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment