From da2f4c5e06159d7a49cb8805123030d5cf0db7fc Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Mon, 9 Dec 2024 23:16:29 +0100 Subject: [PATCH] add tauri-sqlite and guest module --- bun.lockb | Bin 43850 -> 44264 bytes package.json | 3 +- src-tauri/Cargo.lock | 753 ++++++++++++++++++++++++++++++++++ src-tauri/Cargo.toml | 1 + src-tauri/src/actions.rs | 9 + src-tauri/src/handlers/mod.rs | 4 - src-tauri/src/lib.rs | 5 +- src/routes/+page.svelte | 11 + 8 files changed, 779 insertions(+), 7 deletions(-) create mode 100644 src-tauri/src/actions.rs delete mode 100644 src-tauri/src/handlers/mod.rs diff --git a/bun.lockb b/bun.lockb index f60ba7304f3e1d2325f9aa991c65cde1bf36f5e5..cb3bc551991b141ed1797fda8359a437c163608e 100644 GIT binary patch delta 6915 zcmd^EdsLNG7XQu%SMCL`Lh-nl3-VGCLEiEZxEB-=yddK1Qw$9Sk$A~dED;LH4qa!}KxV!b>w~rcP2GcseI4c&${Qc!O4{U$v_Z=ZG)s|{^ zT$#ULke?M@Qc!zrolUXv;euf8hUg1y0FDH90Cm8Y%BFJewXCtcrM$MOaYbEY)6&L9 zp;8nCE$oYd?!em8+PcazK`3ur(p*_xCPb zA1)Y$PzcYXAPBh4jus%Vs07FxG}_BU?YbM#fbv0#5W_=8V{|>B>3}d;doaq}s)p_f zyg~J%-{fm3#rsy|W>w+e65ZkM3>4~(&OY&NW3ux0}JGAJu= zDXnfU7nau5RaIgIC!ib?VZ~6%>)Pv%)$eT@JYV)*-}T2XT#MIQw$^8R92d77+d!#m6Z?uRYLhrlq+Yd=wa|dtq(+=a#?x-(qdWi#Tu|l&5&%rcpZ}MT_Um3*sQ;S zWGnjwlEi;2PV%8%ZzJoV0dEsKMyWm~%@ATF6Z7iI=atn_kB>==@uNW>BdeiQUlTh> z7GIN!VaLP(2d9a7IvVsfvW=ALXHp$OaT48Br)j>1lx?dgFoo%9(9g)~DOG1;FOvoQ zTk6r7#M%Bds55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lDlUfGuabgANE1eg4{@( z-C-nyR~DUou)=BS4%%Bt`0U~la`@Ibjg)Tg%g=Ye`JC-%=zlt<0R7j-&^FS@1?P7? z_3DLl+pfr*Z}p|gXGYVYuaKdz-G<9ZWqX=AIl-TCe<^{!-@aP@a{`$=Qh74m9fk6> z1lrY+Du&Q=9g}die7nP*a0B@YD~6x*$$W%P2(1dAqugi;7s+G%S@g{`ep}i|Bb(gP z)mt|7MBIKE7sBdo3(aRcxE4IO(dlhD6uvz<#)>BSY~7xfaauGDAI#b2cX{$Km2H2H dPIfwJ%8!PTWyfvw<_ String { + format!("Hello, {}! You've been waved from Rust, with a different file!", name) +} + +#[tauri::command] +pub fn greet(name: &str) -> String { + format!("Hello, {}! You've been greeted from Rust, with a different file!", name) +} \ No newline at end of file diff --git a/src-tauri/src/handlers/mod.rs b/src-tauri/src/handlers/mod.rs deleted file mode 100644 index 6fc4fd4..0000000 --- a/src-tauri/src/handlers/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[tauri::command] -pub fn greet(name: &str) -> String { - format!("Hello, {}! You've been greeted from Rust, with a different file!", name) -} \ No newline at end of file diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 6032f9a..e276ed4 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,11 +1,12 @@ // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ -mod handlers; +mod actions; #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() .plugin(tauri_plugin_shell::init()) - .invoke_handler(tauri::generate_handler![handlers::greet]) + .plugin(tauri_plugin_sql::Builder::default().build()) + .invoke_handler(tauri::generate_handler![actions::greet, actions::wave]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index eb3daec..667f133 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -9,6 +9,12 @@ // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ greetMsg = await invoke("greet", { name }); } + + async function wave(event: Event) { + event.preventDefault(); + // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ + greetMsg = await invoke("wave", { name }); + }
@@ -31,6 +37,11 @@ + +
+ + +

{greetMsg}