Skip to main content

Directive

Trait Directive 

Source
pub trait Directive:
    Clone
    + Debug
    + PartialEq
    + Eq {
    // Required methods
    fn parse(name: &str, args: &str) -> Option<Parsed<Self>>;
    fn print(&self) -> String;

    // Provided method
    fn kind(&self) -> Option<&'static str> { ... }
}
Expand description

A step a game adds to the format: @<name> <args>, for a name the engine’s own directives don’t use. The parser reads it with Directive::parse, a scene keeps it in order as Step::Directive, and the game plays it.

Required Methods§

Source

fn parse(name: &str, args: &str) -> Option<Parsed<Self>>

Reads the line @<name> <args> (args trimmed): None if none of the game’s directives is called name; otherwise the step, if one could be made, and every problem with the line.

Source

fn print(&self) -> String

The line as written, without its @ (place market 3,12): what print_scene writes. Parsing it gives the directive back.

Provided Methods§

Source

fn kind(&self) -> Option<&'static str>

For a directive that stays in force until the next one of its kind (a place drawn behind the talk), that kind’s name, written as the directive is (place): every part of a @choice or an @if block must then leave the same one in force. None for one that doesn’t stay.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§