Install
Adding Specta to custom types
use Type;
use ;
// The `specta::Type` macro allows us to understand your types
// We implement `specta::Type` on primitive types for you.
// If you want to use a type from an external crate you may need to enable the feature on Specta.
Annotate your Tauri commands with Specta
// <-- This bit here
// <-- This bit here
Export your bindings
use collect_types;
use ;
// this example exports your types on startup when in debug mode or in a unit test. You can do whatever.
Usage on frontend
import * as commands from "./bindings"; // This should point to the file we export from Rust
await commands.greet("Brendan");
Known limitations
- Your command can only take up to 10 arguments. Any more and you'll get a compile error. If you need more just use a struct.
- Exporting your schema within a directory tracked by Tauri's hot reload will cause an infinite reload loop.
Development
Run the example:
Credit
Created by oscartbeaumont and Brendonovich.