i got the error/log
enter rust time: 21:58:37.964800200
thread 'tokio-runtime-worker' panicked at src\main.rs:71:9:
not yet implemented
my cargo.toml
[package]
name = "tauri-app"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "2.0.0-beta", features = [] }
[dependencies]
tauri = { version = "2.0.0-beta", features = [] }
tauri-plugin-shell = "2.0.0-beta"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tauri-plugin-dialog = "2.0.0-beta.4"
tauri-plugin-fs = "2.0.0-beta.4"
systemstat = "0.2.3"
chrono = "0.4"
Is this not implemented yet, or where do I need to activate it?
call code
invoke("new_append_chunk_to_file", new Uint8Array([]), {
headers: {
path: `/path/to/test.dll`,
end: "false",
},
});
command code
#[tauri::command]
async fn new_append_chunk_to_file(
request: tauri::ipc::Request<'_>,
) -> Result<(), String> {
let current_time = Local::now().time();
println!("enter rust time: {}", current_time);
if let tauri::ipc::InvokeBody::Raw(data) = request.body() {
let path = PathBuf::from(request.headers().get("path").unwrap().to_str().unwrap());
let mut file = OpenOptions::new()
.create(true)
.append(true)
.open(&path)
.map_err(|e| e.to_string())
.unwrap();
file.write_all(data).map_err(|e| e.to_string()).unwrap();
let current_time = Local::now().time();
println!("return time: {}", current_time);
Ok(())
} else {
todo!()
}
}