impl_trait!() { /* proc-macro */ }
Expand description
Takes the name of a trait and an impl block, and emits a ghost struct that
implements that trait using the provided fn signatures—stripping away any
generics and arguments with tauri
as the first path segment.
TODO: accept a list of arguments to ignore vs relying on the tauri::
prefix.
§Examples
ⓘ
trait Commands {
async foo(bar: String) -> Result<(), String>;
async bar(foo: String) -> Result<(), String>;
}
tauri_bindgen_rs_macros::impl_trait!(Commands, {
#[tauri::command]
async foo(state: tauri::State, bar: String) -> Result<(), String> {
Ok(())
}
#[tauri::command]
async bar(state: tauri::State, foo: String) -> Result<(), String> {
Ok(())
}
});