Skip to main content

brink_format/
counting.rs

1use bitflags::bitflags;
2
3bitflags! {
4    /// Container-level structural flags: what the runtime counts for a
5    /// container, plus the FS-3 "invisible" marker.
6    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7    pub struct CountingFlags: u8 {
8        /// Track how many times this container has been visited.
9        const VISITS          = 0x01;
10        /// Track the turn number at which this container was last visited.
11        const TURNS           = 0x02;
12        /// Only count the visit/turn when the container is entered at its
13        /// first line (not when re-entered mid-way).
14        const COUNT_START_ONLY = 0x04;
15        /// This is a synthesized **invisible continuation container**
16        /// (`docs/flow-suspension-spec.md` §11.2): the tail of an awaiting
17        /// def split off at an `await` site (§11.1). It is compiler plumbing,
18        /// not story structure, so it carries **no visit counts** (never
19        /// [`VISITS`](Self::VISITS)/[`TURNS`](Self::TURNS) — they would
20        /// pollute `shuffle`/`once` semantics in behavior loops), is **not a
21        /// valid divert target**, and is **hidden from IDE navigation and
22        /// completion** (debug views such as the `.inkt` dump excepted). The
23        /// runtime enters it only via the FlowFrame resume path, never a
24        /// user-authored divert. Reserved-through-fence: nothing in the
25        /// compiler emits it while the E052 `await` lowering fence stands
26        /// (FS-3c); its first emission rides the continuation-splitting
27        /// codegen when the fence drops (FS-3r).
28        const INVISIBLE       = 0x08;
29    }
30}