Skip to main content

DialogueHooks

Trait DialogueHooks 

Source
pub trait DialogueHooks:
    Clone
    + Debug
    + PartialEq
    + Eq {
    type Directive: Directive;
    type Stage: Clone + Debug + Default + PartialEq + Eq;

    // Required methods
    fn fill<'a>(&self, text: &'a str) -> Cow<'a, str>;
    fn direct(&self, stage: &mut Self::Stage, directive: &Self::Directive);
}
Expand description

What a game adds to playing a scene: its own lines (Directives, such as a place behind the talk) and what they have set so far (its Stage), and the tokens it fills into the text (the hero’s name, say).

Required Associated Types§

Source

type Directive: Directive

The game’s own lines.

Source

type Stage: Clone + Debug + Default + PartialEq + Eq

What the game’s lines have set so far: nothing until the first.

Required Methods§

Source

fn fill<'a>(&self, text: &'a str) -> Cow<'a, str>

text as shown: the game’s tokens filled in. The scene keeps them.

A game with tokens of its own and name tokens ({n:<id>}) fills both: its own, and the names with Names::substitute. A game with only name tokens plays with Named.

Source

fn direct(&self, stage: &mut Self::Stage, directive: &Self::Directive)

Plays the game’s line directive on stage, when the scene reaches it (read or skipped).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§