Struct repl_framework::Repl [−][src]
pub struct Repl { /* fields omitted */ }
The main Repl Struct which contains pretty much everything the crate has to offer
Implementations
impl Repl
[src]
impl Repl
[src]Repl methods
pub fn take_arg_return(&self) -> Vec<String>
[src]
same as take_arg, but returns the argument instead of storing it in self.argument
pub fn custom(
prompt: &str,
exit: &str,
functions: HashMap<String, fn(_: Vec<String>)>
) -> Repl
[src]
prompt: &str,
exit: &str,
functions: HashMap<String, fn(_: Vec<String>)>
) -> Repl
returns a customized Repl currently not much different from normal new other than the choice of exit keyword
Example
ⓘ
use repl_framework::Repl; fn main() { let mut repl = Repl::custom( prompt: &str, exit: &str, functions: HashMap<String, fn(Vec<String>)> ); }
pub fn new(prompt: &str) -> Repl
[src]
returns new repl
Example
ⓘ
use repl_framework::Repl; fn test(_: Vec<String>) { println!("test"); } fn main() { let mut repl = Repl::new(">>> "); repl.add_function("test", test as fn(Vec<String>)); repl.run(); }
pub fn from_interpreter(
interpreter: Interpreter,
prompt: &str,
exit: &str
) -> Repl
[src]
interpreter: Interpreter,
prompt: &str,
exit: &str
) -> Repl
pub fn add_function(&mut self, name: String, func: fn(_: Vec<String>))
[src]
pub fn run(&mut self)
[src]
runs the repl
Example
ⓘ
use repl_framework::Repl; use std::collections::HashMap; fn test(_: Vec<String>) { println!("test!"); } fn main() { let mut hashmap = HashMap::new(); hashmap.insert("test".to_string(), test as fn(Vec<String>)); let mut repl = Repl::new(">>> ", hashmap); repl.run() }
pub fn run_debug(&mut self)
[src]
Runs the repl in debug mode
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Repl
impl RefUnwindSafe for Repl
impl UnwindSafe for Repl
impl UnwindSafe for Repl