wyrd/runtime_impl/
handles.rs1macro_rules! runtime_handle {
9 ($name:ident, $doc:literal) => {
10 #[doc = $doc]
11 #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
12 pub struct $name {
13 pub(crate) owner: usize,
14 pub(crate) index: u16,
15 }
16
17 impl $name {
18 pub(crate) const fn new(owner: usize, index: u16) -> Self {
19 Self { owner, index }
20 }
21
22 pub const fn get(self) -> u16 {
24 self.index
25 }
26 }
27 };
28}
29
30runtime_handle!(
31 SenseId,
32 "A host-writable SignalIn handle owned by one Runtime."
33);
34runtime_handle!(
35 HostPathId,
36 "An interned SignalOut path handle owned by one Runtime."
37);
38runtime_handle!(
39 CmdId,
40 "An interned EmitCommand handle owned by one Runtime."
41);
42runtime_handle!(
43 KnotHandle,
44 "A knot handle owned by one Runtime, for checked tooling access."
45);