Function tauri_sys::tauri::invoke

source ·
pub async fn invoke<A: Serialize, R: DeserializeOwned>(
    cmd: &str,
    args: &A,
) -> Result<R, Error>
Expand description

Sends a message to the backend.

§Example

use tauri_api::tauri::invoke;

struct User<'a> {
    user: &'a str,
    password: &'a str
}

invoke("login", &User { user: "tauri", password: "poiwe3h4r5ip3yrhtew9ty" }).await;

@param cmd The command name. @param args The optional arguments to pass to the command. @return A promise resolving or rejecting to the backend response.