pub fn run<'a, N, F>(
start: N,
state: &'a mut N::State,
frontend: &'a mut F,
) -> RunBuilder<'a, N, F>Expand description
Run the narrative starting at the given Node and state
Examples found in repository?
More examples
examples/rooms.rs (lines 105-109)
104fn main() {
105 run(
106 Room::Start,
107 &mut State { has_key: false },
108 &mut CliFrontend::new(),
109 )
110 .command("save", |rt| {
111 match rt.save("rooms.yaml") {
112 Ok(_) => rt.println("Save complete"),
113 Err(e) => rt.println(format!("Error: {}", e)),
114 }
115 Continue
116 })
117 .command("load", |rt| {
118 match rt.load("rooms.yaml") {
119 Ok(_) => rt.println("Load complete"),
120 Err(e) => rt.println(format!("Error: {}", e)),
121 }
122 Skip
123 })
124 .command("inv, inventory", |rt| rt.push_node(Inventory));
125}