Files
u-ppt/src-tauri/src/lib.rs
绝尘 a1ac91c1ec 新增: Tauri IPC 命令 + useStore 统一接口(B4)
- commands.rs: exec_op/undo/redo/can_undo/can_redo/get_deck/set_navigation/save_file
  Rust AppState 持有 deck + 历史栈,所有写操作通过 Op Log
- bridge.ts: 安全 Tauri IPC 调用层(动态 import,Web 模式 mock)
- useStore.ts: 统一 store 接口,检测 __TAURI__ 环境
  Web 模式直接调 TS store;Tauri 模式走 invoke
- 50 个测试全部通过,前后端编译零错误
2026-07-12 22:41:10 +08:00

37 lines
788 B
Rust

mod ai;
mod color;
mod commands;
mod model;
mod op;
pub fn run() {
let app_state = commands::AppState::new();
tauri::Builder::default()
.manage(app_state)
.invoke_handler(tauri::generate_handler![
commands::ping,
commands::app_info,
commands::exec_op,
commands::undo,
commands::redo,
commands::can_undo,
commands::can_redo,
commands::get_deck,
commands::set_navigation,
commands::save_file,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
#[cfg(test)]
mod tests {
use super::commands;
#[test]
fn test_ping() {
assert_eq!(commands::ping(), "pong");
}
}