Hi,
I try to use : https://v2.tauri.app/develop/calling-rust/#returning-array-buffers to return some data in frontend.
So i code a very simple example :
#[tauri::command]
pub async fn sql_request(code_sql: &str, sources:Vec<source::Source>) -> Response {
let bytes: [u8; 3] = [1, 0, 2];
tauri::ipc::Response::new(bytes)
}
And i have this error and i not sure how to solve it (i kind a newbie in rust) :
error[E0277]: async commands that contain references as inputs must return a `Result`
--> src/commands.rs:20:74
|
20 | pub async fn sql_request(code_sql: &str, sources:Vec<source::Source>) -> Response {
| ^^^^^^^^ the trait `AsyncCommandMustReturnResult` is not implemented for `tauri::ipc::Response`
|
= help: the trait `AsyncCommandMustReturnResult` is implemented for `Result<A, B>`
= note: required for the cast from `&tauri::ipc::Response` to `&dyn AsyncCommandMustReturnResult`
error[E0277]: the trait bound `InvokeResponseBody: std::convert::From<[u8; 3]>` is not satisfied
--> src/commands.rs:22:31
|
22 | tauri::ipc::Response::new(bytes)
| ------------------------- ^^^^^ the trait `std::convert::From<[u8; 3]>` is not implemented for `InvokeResponseBody`, which is required by `[u8; 3]: Into<InvokeResponseBody>`
Laurent.