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
use Future;
use Stream;
use Serialize;
use DeserializeOwned;
use crate::;
/// Application-facing typed channel API.
///
/// `ChannelHandle` intentionally exposes typed messages only. It does not expose
/// envelopes, byte buffers, protocol frames, publisher identifiers, or transport
/// handles; embedded and remote implementations perform any necessary
/// serialization and schema validation behind this trait.
///
/// # Object safety
///
/// This trait is not object-safe because its methods are generic over message
/// types and because subscriptions/replies are represented with generic
/// associated return types. Use concrete handle types behind generic bounds such
/// as `H: ChannelHandle`, or define an application enum over the concrete handle
/// implementations that need to be selected at runtime. Future SDK layers may
/// add an explicitly erased adapter without weakening the typed API here.
///
/// ```compile_fail
/// use liminal_sdk::ChannelHandle;
/// use serde::Serialize;
///
/// #[derive(Serialize)]
/// struct OnlySerializable {
/// id: String,
/// }
///
/// fn publish_without_schema<H>(handle: &H, message: OnlySerializable)
/// where
/// H: ChannelHandle,
/// {
/// let _ = handle.publish(message);
/// }
/// ```