Skip to main content

allframe_tauri/
types.rs

1//! Request and response types for Tauri IPC commands
2
3use serde::{Deserialize, Serialize};
4
5/// Whether a handler is request/response or streaming
6#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7#[serde(rename_all = "snake_case")]
8pub enum HandlerKind {
9    /// Standard request/response handler
10    RequestResponse,
11    /// Streaming handler that sends incremental updates
12    Streaming,
13}
14
15/// Metadata about a registered handler
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct HandlerInfo {
18    /// Handler name (used to call it)
19    pub name: String,
20    /// Human-readable description
21    pub description: String,
22    /// Whether this handler is request/response or streaming
23    pub kind: HandlerKind,
24}
25
26/// Response from calling a handler
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct CallResponse {
29    /// The handler's return value
30    pub result: String,
31}
32
33/// Response from starting a streaming handler
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct StreamStartResponse {
36    /// Unique stream ID for this invocation
37    pub stream_id: String,
38}