Skip to main content

bb_runtime/
atomic.rs

1//! Engine-side atomic dispatch result. Catalog types
2//! (`AtomicOpsetDecl`, `AtomicOpDecl`, `AtomicOpKind`) live in
3//! `bb_ir::atomic`; re-exported here for one-import access.
4
5use crate::ids::CommandId;
6use bb_ir::slot_value::SlotValue;
7
8pub use bb_ir::atomic::{AtomicOpDecl, AtomicOpKind, AtomicOpsetDecl};
9
10/// Return type of `<Role>Runtime::dispatch_atomic`.
11pub enum DispatchResult {
12    /// Outputs ready synchronously.
13    Immediate(Vec<(String, Box<dyn SlotValue>)>),
14    /// Impl will call `ctx.complete_command(cmd_id, outputs)` later.
15    Async(CommandId),
16}
17
18impl std::fmt::Debug for DispatchResult {
19    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20        match self {
21            Self::Immediate(outputs) => f
22                .debug_tuple("Immediate")
23                .field(&format!("<{} outputs>", outputs.len()))
24                .finish(),
25            Self::Async(cmd_id) => f.debug_tuple("Async").field(cmd_id).finish(),
26        }
27    }
28}
29