跳到主要内容
英文版本为准

本页译自英文,由模型翻译。若与英文原文存在差异,以英文原文为准。

保证

无法通过编译的错误,以及编译器对每一种错误给出的提示。

左边是代码里的错误,右边是编译器对它的提示应答类型没有#[derive(Outgoing)]`Receipt` does not declarewhere it is published在已声明地址的应答上使用命名变换`Receipt` does not leta transform namethe destination没有启用任何编解码器特性的挂载no codec is availableto decode thissubscriber's inputOut<impl RequestReply>用在不具备该能力的发布者上`MemoryPublisher` does notsupport request / replymessaging同一个订阅者上同时写 workers(4)和 threads(2)workers(..) and threads(..)fill the same position:name one of them没有目的地的发布this publish hasno destination yet缺少消息所声明的消息头的发布the headers of this publishdo not match the message'scontract你写的编译器的回答
以文字阅读本图
  1. 应答类型 没有 #[derive(Outgoing)] → `Receipt` does not declare where it is published
  2. 在已声明地址的 应答上使用 命名变换 → `Receipt` does not let a transform name the destination
  3. 没有启用 任何编解码器 特性的挂载 → no codec is available to decode this subscriber's input
  4. Out<impl RequestReply> 用在不具备该 能力的发布者上 → `MemoryPublisher` does not support request / reply messaging
  5. 同一个订阅者上 同时写 workers(4) 和 threads(2) → workers(..) and threads(..) fill the same position: name one of them
  6. 没有目的地 的发布 → this publish has no destination yet
  7. 缺少消息所声明 的消息头的发布 → the headers of this publish do not match the message's contract
  8. 你写的
  9. 编译器的回答

编译器能看出的错误,RustStream 就让它成为编译错误,而不是启动时或每条消息上的检查。每条消息上的检查会让每次投递都付出代价,启动时的检查则只有在服务第一次运行的地方才能发现错误。每条提示都会指出出错的类型或步骤。

图中各行依次对应应答、变换、编解码器、发布者能力、分发、发布和类型化消息头的规则。挂载链上已经设定过的设置不能再设定一次;Broker 不具备的能力,表现为缺少方法或约束不满足。

生命周期同样是类型化的:未连接的 Broker 没有用来订阅或发布的方法,已关闭的 Broker 已经被消耗掉了。