Skip to main content

command

Attribute Macro command 

Source
#[command]
Expand description

Turns this function into a Tauri command and creates a test that generates a TypeScript binding to this function. To generate TypeScript bindings, run cargo test Important: In order for this macro to work, both ts_rs and serde need to be in scope. This can be achieved by importing the prelude: use tauri_bindgen_ts::prelude::*

By default, the location is set to “../src-gen” which results in a top-level directory “src-gen in your Tauri app. A different output directory can be specified by passing a path as string argument, i.e. #[entity("./my-custom-dir)"] struct MyStruct { }