framework agnostic core cargo

This commit is contained in:
polv committed 2026-02-21 22:00:26 +07:00
1 parent afc8bc60e0
commit 876b879a65
16 files changed
+5569 -31

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
{
"editor.tabSize": 2,
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": true
},
"[javascript]": {
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.formatOnSave": true
},
"[rust]": {
"editor.tabSize": 4,
"editor.formatOnSave": true
}
}
+1 -5
View File
@@ -23,8 +23,4 @@ tauri-plugin-opener = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
rusqlite = { version = "0.38.0", features = ["bundled", "unlock_notify"] }
[profile.release]
lto = true
codegen-units = 1
strip = true
cjdic2-core = { path = "../src-core" }
+5 -24
View File
@@ -24,7 +24,8 @@ pub fn run() {
let db_path = app_dir.join("cjdic.db");
let is_new = !db_path.exists();
println!("{:?}", db_path);
println!("{}", cjdic2_core::add(1, 2));
let conn = Connection::open(&db_path)?;
@@ -44,29 +45,9 @@ pub fn run() {
.build(tauri::generate_context!())
.expect("error while running tauri application")
.run(|_app_handle, event| match event {
tauri::RunEvent::ExitRequested { .. } => {
// api.prevent_exit();
// let handle = app_handle.clone();
// if let Some(state) = app_handle.try_state::<state::AppState>() {
// if let Ok(conn) = state.conn.lock() {
// if let Err(e) = (|| -> Result<(), rusqlite::Error> {
// conn.execute_batch("PRAGMA optimize;")?;
// conn.execute("PRAGMA wal_checkpoint(FULL);", [])?;
// let (_busy, _log, _checkpointed): (i32, i32, i32) =
// conn.query_row("PRAGMA wal_checkpoint(FULL);", [], |row| {
// Ok((row.get(0)?, row.get(1)?, row.get(2)?))
// })?;
// Ok(())
// })() {
// eprintln!("Shutdown SQL failed: {e}");
// }
// }
// }
// handle.exit(0);
}
// On exit handler should be avoided for mobile
// and rusqlite already closes gracefully by default
tauri::RunEvent::ExitRequested { .. } => {}
_ => {}
});
}