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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! Branching sequences with subroutines and external waits.
//!
//! A sequence is an ordered list of steps:
//!
//! ```text
//! say "Hello, traveler."
//! say "Have you seen my ring?"
//! [choice] "Yes" ──▶ ring_found
//! "No" ──▶ ring_lost
//!
//! ring_found: remove item "gold ring"
//! advance quest "The Lost Ring" to stage 2
//! say "You have my thanks."
//! ```
//!
//! `plotline` runs order, branches, calls, returns, jumps, and waits. The
//! host defines the steps. Use it for dialog, quests, cutscenes, tutorials —
//! any authored flow that must not depend on an engine.
//!
//! # The pieces
//!
//! [`Sequence`] stores shared steps. [`Runner`] stores run state. [`Library`]
//! stores sequences and creates their [`SequenceRef`] handles. Steps use
//! [`Condition`] to read state and [`Effect`] to change it; both connect the
//! host systems and also work outside the runner.
//!
//! # Control flow
//!
//! [`Progress::Call`] enters a subroutine, and falling off its end returns to
//! the caller. [`Progress::Return`] exits the current subroutine early.
//! [`Progress::Goto`] clears the whole call chain before starting its target,
//! or ends the chain when it has no target.
//!
//! # No clock
//!
//! A step that needs to wait returns [`Progress::Wait`] with a [`Completion`]
//! handle. The host signals the handle and calls [`Runner::advance`]. A
//! multi-phase step can instead return [`Progress::Resume`] and manage its
//! own per-run state through [`StepRun`]. The crate does not define timed
//! waits.
//!
//! # Built-ins
//!
//! The [`steps`], [`conditions`], and [`effects`] modules cover the common
//! cases. [`steps::run`] wraps a closure; its body can return `()`, a
//! [`Completion`], a [`Progress`], or any other type that implements
//! [`IntoProgress`]. [`conditions::check`] and [`effects::run`] give the
//! same closure-first style for conditions and effects, and [`steps::when`]
//! conditionally runs any step. Constructors such as [`conditions::flag`],
//! [`effects::set_flag`], [`steps::goto`], and [`steps::stop`] are shorthand
//! over the public structs and do not remove the struct-literal API.
//!
//! # Validation and analysis
//!
//! [`Library::validate`] reports empty or duplicate names, step and
//! nested-object warnings, and references to missing sequences. It permits
//! cycles, which are valid in authored graphs. [`StepFacts::references`]
//! exposes every outgoing sequence reference, including both sides of a
//! branch. [`FlowModel`] computes reachability for one sequence — the basis
//! for an editor's rail display.
//!
//! # Diagnostics
//!
//! The runner reports [`RunnerEvent`] values; the host drains them with
//! [`Runner::drain_events`] and decides how to log them. [`Context::note`]
//! adds location-tagged notes from inside a step.
//!
//! # Feature flags
//!
//! The default `std` feature catches panics in steps, which requires
//! `panic = "unwind"`. Without it, the crate uses `alloc` only and does not
//! catch panics.
extern crate alloc;
extern crate std;
pub use Completion;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// The README is compiled as part of the test suite, so its examples cannot rot.
;