Struct yarn_spool::YarnEngine [−][src]
pub struct YarnEngine { /* fields omitted */ }
The engine that stores all conversation-related state.
Methods
impl YarnEngine
[src]
impl YarnEngine
pub fn new(handler: Box<YarnHandler>) -> YarnEngine
[src]
pub fn new(handler: Box<YarnHandler>) -> YarnEngine
Create a new YarnEngine instance associated with the given handler.
pub fn load_from_string(&mut self, s: &str) -> Result<(), ()>
[src]
pub fn load_from_string(&mut self, s: &str) -> Result<(), ()>
Parse the provided string as a series of Yarn nodes, appending the results to the internal node storage. Returns Ok if parsing succeeded, Err otherwise.
pub fn register_function(
&mut self,
name: String,
num_args: usize,
callback: Box<FunctionCallback>
)
[src]
pub fn register_function(
&mut self,
name: String,
num_args: usize,
callback: Box<FunctionCallback>
)
Register a native function for use in Yarn expressions.
pub fn set_variable(&mut self, name: VariableName, value: Value)
[src]
pub fn set_variable(&mut self, name: VariableName, value: Value)
Set a given variable to the provided value. Any Yarn expressions evaluated after this call will observe the new value when using the variable.
pub fn activate(&mut self, node: NodeName)
[src]
pub fn activate(&mut self, node: NodeName)
Begin evaluating the provided Yarn node.
pub fn choose(&mut self, choice: usize)
[src]
pub fn choose(&mut self, choice: usize)
Make a choice between a series of options for the current Yarn node's active step. Execution will resume immediately based on the choice provided.
pub fn proceed(&mut self)
[src]
pub fn proceed(&mut self)
Resume execution of the current Yarn node.
Auto Trait Implementations
impl !Send for YarnEngine
impl !Send for YarnEngine
impl !Sync for YarnEngine
impl !Sync for YarnEngine