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§

Structs§

  • 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.
  • 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 be have the #[taurpc::procedures] and the nested routes should have #[taurpc::procedures(path = "path")].

Enums§

  • Enum used for triggering scoped events instead of on all windows. Use the send_to(scope: Windows) method on your event trigger struct.

Traits§

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

Functions§

  • 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§

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