Crate taurpc

Source
Expand description

This crate provides a typesafe IPC layer for Tauri’s commands and events. TauRPC should be used instead of Tauri’s IPC system, which does not provide TypeScript types for your commands or events.

Go the the GitHub page to get started.

Re-exports§

pub extern crate serde;
pub extern crate specta;
pub extern crate specta_macros;

Structs§

EventTrigger
A structure used for triggering tauri events on the frontend. By default the events are send to all windows with emit_all, if you want to send to a specific window by label, use new_scoped or new_scoped_from_trigger.
Router
Used for merging nested trait implementations. This is used when you have multiple trait implementations, instead of taurpc::create_ipc_handler(). Use .merge() to add trait implementations to the router. The trait must have the #[taurpc::procedures] macro and the nested routes should have #[taurpc::procedures(path = "path")].
Typescript
Typescript language exporter.

Traits§

TauRpcHandler
A trait, which is automatically implemented by #[taurpc::procedures], that is used for handling incoming requests and the type generation.

Functions§

create_ipc_handler
Creates a handler that allows your IPCs to be called from the frontend with the coresponding types. Accepts a struct in which your taurpc::procedures trait is implemented. If you have nested routes, look at taurpc::Router.

Attribute Macros§

ipc_type
Add this macro to all structs used inside the procedures arguments or return types. This macro is necessary for serialization and TS type generation.
procedures
Generates the necessary structs and enums for handling calls and generating TS-types.
resolvers
Transforms all methods to return Pin<Box<Future<Output = ...>>>, async traits are not supported.