Struct papyrus::Repl

source ·
pub struct Repl {
    pub commands: Vec<Command>,
    pub items: Vec<Vec<String>>,
    pub statements: Vec<Vec<String>>,
    pub name: &'static str,
    pub prompt_colour: Color,
    pub out_colour: Color,
    /* private fields */
}
Expand description

A REPL instance.

Fields

commands: Vec<Command>

The REPL handled commands. Can be extended.

let repl = Repl::new();
repl.commands.push(Command::new("load", CmdArgs::Filename, "load and evaluate file contents as inputs", |r, arg_text| {
	r.run_file(arg_text);
}));
items: Vec<Vec<String>>

Items compiled into every program. These are functions, types, etc.

statements: Vec<Vec<String>>

Blocks of statements applied in order.

name: &'static str

App and prompt text.

prompt_colour: Color

The colour of the prompt region. ie papyrus.

out_colour: Color

The colour of the out component. ie [out0].

Implementations

A new REPL instance.

Runs the file and returns a new REPL instance.

A new REPL instance with the given prompt.

Panics
  • prompt is empty.

Run the REPL interactively.

Panics
  • Failure to initialise InputReader.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.