1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! ConnectRPC transport over Tauri IPC.
//!
//! Carries the Connect protocol over Tauri commands and channels instead of
//! HTTP. The webview is the client; Rust hosts the services.
//!
//! Neither side reimplements the protocol. `ConnectRpcService` is already a
//! `tower::Service<http::Request>`, and on the TypeScript side
//! `@connectrpc/connect/protocol-connect` accepts any byte-level client. This
//! crate is the shuttle between them, so framing, compression negotiation,
//! trailers, and error mapping all come from the existing runtime.
//!
//! # Usage
//!
//! ```rust,ignore
//! let router = Arc::new(MyService).register(connectrpc::Router::new());
//! tauri::Builder::default()
//! .plugin(connectrpc_tauri::serve(ConnectRpcService::new(router)))
//! .run(tauri::generate_context!())?;
//! ```
//!
//! # Concurrency
//!
//! Every IPC command is `async` and nothing in the request path blocks the
//! runtime. The one synchronous lock guards a hash map and is never held across
//! an await, which the `await_holding_lock` lint below enforces.
// A guard held across an await would stall every other call on this app.
pub use DeferredDispatcher;
pub use ;
pub use CallId;
pub use SCHEME;
/// Generated wire types for the transport envelopes.
///
/// Public so tests and hand-written clients can build frames; the shapes are
/// mirrored by `packages/transport` on the TypeScript side.
/// The demo service used by the tests and the example app.
///
/// Behind a feature flag so it does not ship in production builds of the
/// transport.