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
//! Lightweight, engine-agnostic dialogue runtime for Rust games.
//!
//! On [crates.io](https://crates.io/crates/bubbles-dialogue) the package is **bubbles-dialogue**
//! because the crate name **bubbles** was already taken there. This library is still named
//! **bubbles**: depend on `bubbles-dialogue` in `Cargo.toml` and `use bubbles::…` in code.
//!
//! Write branching dialogue in `.bub` scripts, compile them once, then drive
//! the dialogue from any game loop via a pull-based event API.
//!
//! # Quick start
//!
//! ```rust
//! use bubbles::{compile, DialogueEvent, HashMapStorage, Runner};
//!
//! let source = "title: Greet\n---\nHello!\n===\n";
//! let prog = compile(source).unwrap();
//! let mut runner = Runner::new(prog, HashMapStorage::new());
//! runner.start("Greet").unwrap();
//!
//! assert!(matches!(
//! runner.next_event().unwrap(),
//! Some(DialogueEvent::NodeStarted(_))
//! ));
//! assert!(matches!(
//! runner.next_event().unwrap(),
//! Some(DialogueEvent::Line { .. })
//! ));
//! assert!(matches!(
//! runner.next_event().unwrap(),
//! Some(DialogueEvent::NodeComplete(_))
//! ));
//! assert!(matches!(
//! runner.next_event().unwrap(),
//! Some(DialogueEvent::DialogueComplete)
//! ));
//! ```
//!
//! # Modules
//!
//! | Module | Contents |
//! |--------|----------|
//! | [`value`] | [`Value`], [`VariableStorage`], [`HashMapStorage`] |
//! | [`compiler`] | [`compile`], [`compile_many`], [`validate`], [`Program`], [`VariableDecl`] |
//! | [`runtime`] | [`Runner`], [`RunnerPhase`], [`DialogueEvent`], [`LineMode`], [`LineProvider`], [`line_id_from_tags`], [`line_mode_from_tags`], [`RunnerSnapshot`] |
//! | [`library`] | [`FunctionLibrary`] and built-in functions |
//! | [`saliency`] | [`SaliencyStrategy`], [`FirstAvailable`], [`BestLeastRecentlyViewed`], `RandomAvailable` (`rand` feature) |
//!
//! Lint policy is defined once in `Cargo.toml` under `[lints.rust]` /
//! `[lints.clippy]`; we deliberately do not duplicate it here.
pub use ;
pub use ;
pub use FunctionLibrary;
pub use RunnerSnapshot;
pub use ;
pub use RandomAvailable;
pub use ;
pub use ;