run

Function run 

Source
pub fn run<'a, N, F>(
    start: N,
    state: &'a mut N::State,
    frontend: &'a mut F,
) -> RunBuilder<'a, N, F>
where N: Node, F: Frontend,
Expand description

Run the narrative starting at the given Node and state

Examples found in repository?
examples/counter.rs (lines 46-50)
45fn main() {
46    run(
47        MyNode::Small,
48        &mut State { count: 0 },
49        &mut CliFrontend::new(),
50    );
51}
More examples
Hide additional 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}