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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/// Public runtime/worker types. (Stage 1 submodule grouping.)
/// Public trigger types. (Stage 1 submodule grouping.)
/// Public channel types. (Stage 1 submodule grouping.)
/// Public error types. (Stage 1 submodule grouping.)
// No `internal` submodule for Rust: the internal types grouped under
// `iii-sdk/internal` (Node) and `iii.internal` (Python) have no crate-root
// equivalent here. There is no `InternalHttpRequest` (the Rust SDK uses
// `iii_helpers::http::HttpRequest`), and the stream result types
// (`StreamSetResult`, `StreamUpdateResult`, `StreamDeleteResult`) live in `iii_helpers::stream`
// and are consumed inside `stream_provider.rs`, they are not re-exported at
// the crate root. Grouping them here would re-surface clean-break helpers
// types into the SDK, which the `compile_fail` doctests below deliberately
// forbid. Hence the `internal` grouping is a no-op for Rust.
pub use ;
pub use TelemetryOptions;
pub use ;
pub use EnqueueResult;
pub use ;
pub use IStream;
pub use MiddlewareFunctionInput;
pub use ;
/// Configuration options passed to [`register_worker`].
///
/// # Examples
/// ```rust,no_run
/// use iii_sdk::{register_worker, InitOptions};
///
/// let worker = register_worker("ws://localhost:49134", InitOptions::default());
/// ```
/// Create and return a connected SDK instance. The WebSocket connection is
/// established automatically in a dedicated background thread with its own
/// tokio runtime.
///
/// Call [`IIIClient::shutdown`] before the end of `main` to cleanly stop the
/// connection and join the background thread. In Rust the process exits
/// when `main` returns, terminating all threads, so `shutdown()` must be
/// called while `main` is still running.
///
/// # Arguments
/// * `address` - WebSocket URL of the III engine (e.g. `ws://localhost:49134`).
/// * `options` - Configuration for worker metadata and OTel.
///
/// # Examples
/// ```rust,no_run
/// use iii_sdk::{register_worker, InitOptions};
///
/// let worker = register_worker("ws://localhost:49134", InitOptions::default());
/// // register functions, handle events, etc.
/// worker.shutdown(); // cleanly stops the connection thread
/// ```
// ---------------------------------------------------------------------------
// Compile-fail doctests: these enforce that the four channel items relocated
// to `helpers` are NOT reachable at the crate root. They live here (not in
// `tests/`) because `cargo test --doc` only picks up doctests inside `src/`.
// ---------------------------------------------------------------------------
/// ```compile_fail
/// use iii_sdk::ChannelDirection;
/// ```
/// ```compile_fail
/// use iii_sdk::ChannelItem;
/// ```
/// ```compile_fail
/// use iii_sdk::extract_channel_refs;
/// ```
/// ```compile_fail
/// use iii_sdk::is_channel_ref;
/// ```
// ---------------------------------------------------------------------------
// Compile-fail doctest: enforces that `create_channel` (relocated to
// `helpers`) is no longer callable on `IIIClient`.
// ---------------------------------------------------------------------------
/// ```compile_fail
/// let iii = iii_sdk::IIIClient::new("ws://x");
/// iii.create_channel(None);
/// ```
// ---------------------------------------------------------------------------
// Stage 1 runtime submodule: runtime/worker types are reachable at their new
// canonical path `iii_sdk::runtime`.
// ---------------------------------------------------------------------------
/// ```rust,no_run
/// use iii_sdk::runtime::{
/// FunctionInfo, FunctionRef, IIIConnectionState, TriggerInfo, TriggerTypeRef, WorkerInfo,
/// WorkerMetadata,
/// };
/// ```
/// ```compile_fail
/// use iii_sdk::IIIConnectionState;
/// ```
// ---------------------------------------------------------------------------
// Stage 1 trigger submodule: trigger types are reachable at their new
// canonical path `iii_sdk::trigger`.
// ---------------------------------------------------------------------------
/// ```rust,no_run
/// use iii_sdk::trigger::{IIITrigger, Trigger, TriggerConfig, TriggerHandler};
/// ```
// ---------------------------------------------------------------------------
// Stage 1 channel submodule: channel types are reachable at their new
// canonical path `iii_sdk::channel`.
// ---------------------------------------------------------------------------
/// ```rust,no_run
/// use iii_sdk::channel::{Channel, ChannelReader, ChannelWriter, StreamChannelRef};
/// ```
// ---------------------------------------------------------------------------
// Stage 1 errors submodule: the renamed error type is reachable at its new
// canonical path `iii_sdk::errors::Error`.
// ---------------------------------------------------------------------------
/// ```rust,no_run
/// use iii_sdk::errors::Error;
/// fn _takes(_e: Error) {}
/// ```
// ---------------------------------------------------------------------------
// 0.20 clean break: the deprecated crate-root re-exports and renamed aliases
// are removed. The relocated types live under their canonical submodule paths
// (`iii_sdk::{trigger,channel,runtime}`) and the renamed types use their new
// names (`IIIClient`, `Error`, `TelemetryOptions`).
// ---------------------------------------------------------------------------
/// ```compile_fail
/// use iii_sdk::{Channel, ChannelReader, ChannelWriter, StreamChannelRef};
/// ```
/// ```compile_fail
/// use iii_sdk::{IIITrigger, Trigger, TriggerConfig, TriggerHandler};
/// ```
/// ```compile_fail
/// use iii_sdk::{FunctionInfo, FunctionRef, TriggerInfo, TriggerTypeRef, WorkerInfo, WorkerMetadata};
/// ```
/// ```compile_fail
/// use iii_sdk::III;
/// ```
/// ```compile_fail
/// use iii_sdk::IIIError;
/// ```
/// ```compile_fail
/// use iii_sdk::WorkerTelemetryMeta;
/// ```
// ---------------------------------------------------------------------------
// Stream types relocated to `iii_helpers::stream`: they are no longer reachable
// at the crate root, and are reachable from the helpers submodule.
// ---------------------------------------------------------------------------
/// ```compile_fail
/// use iii_sdk::{StreamChangeEvent, StreamJoinLeaveEvent};
/// ```
/// ```compile_fail
/// use iii_sdk::{StreamTriggerConfig, StreamJoinLeaveTriggerConfig};
/// ```
/// ```compile_fail
/// use iii_sdk::{UpdateOp, StreamGetInput};
/// ```
/// ```rust,no_run
/// use iii_helpers::stream::{StreamChangeEvent, StreamJoinLeaveEvent};
/// fn _takes(_a: StreamChangeEvent, _b: StreamJoinLeaveEvent) {}
/// ```
// ---------------------------------------------------------------------------
// engine submodule grouping: engine constants and the remote handler type are
// reachable only at their canonical path `iii_sdk::engine`. Rust folds this
// grouping into the existing `engine` module (the file `engine.rs`) rather than
// a separate `pub mod engine { ... }` block, which would clash with it.
// ---------------------------------------------------------------------------
/// ```rust,no_run
/// use iii_sdk::engine::{EngineFunctions, EngineTriggers, RemoteFunctionHandler};
/// let _ = (EngineFunctions::LIST_FUNCTIONS, EngineTriggers::LOG);
/// fn _takes(_h: RemoteFunctionHandler) {}
/// ```
/// ```compile_fail
/// use iii_sdk::{EngineFunctions, EngineTriggers};
/// ```
/// ```rust,no_run
/// use iii_sdk::errors::InvocationError;
/// fn _takes(_e: InvocationError) {}
/// ```
/// ```rust,no_run
/// use iii_sdk::{StreamRequest, StreamResponse};
/// fn _takes(_req: StreamRequest, _res: StreamResponse) {}
/// ```
// ---------------------------------------------------------------------------
// protocol submodule grouping: the low-level protocol message and
// register-input types are reachable only at their canonical path
// `iii_sdk::protocol` and are no longer re-exported at the crate root.
// ---------------------------------------------------------------------------
/// ```rust,no_run
/// use iii_sdk::protocol::{
/// ErrorBody, FunctionMessage, RegisterFunctionMessage, RegisterTriggerInput,
/// RegisterTriggerMessage, RegisterTriggerTypeMessage, TriggerRequest,
/// };
/// ```
/// ```compile_fail
/// use iii_sdk::{
/// ErrorBody, FunctionMessage, RegisterFunctionMessage, RegisterTriggerInput,
/// RegisterTriggerMessage, RegisterTriggerTypeMessage, TriggerRequest,
/// };
/// ```
// ---------------------------------------------------------------------------
// EnqueueResult is re-exported at the crate root for convenience alongside
// `TriggerAction`, mirroring its canonical home in `iii_helpers::queue`.
// ---------------------------------------------------------------------------
/// ```rust,no_run
/// use iii_sdk::EnqueueResult;
/// ```