pub struct Repl { /* private fields */ }Expand description
Run an read/evaluate/print/loop.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut repl = spore_vm::repl::Repl::new(spore_vm::Vm::default())?;
loop {
if let Err(err) = repl.eval_next_input() {
match err {
rustyline::error::ReadlineError::Eof
| rustyline::error::ReadlineError::Interrupted => return Ok(()),
err => println!("{err}"),
}
}
}
}Implementations§
Source§impl Repl
impl Repl
Sourcepub fn eval_next_input(&mut self) -> Result<ProtectedVal<'_>>
pub fn eval_next_input(&mut self) -> Result<ProtectedVal<'_>>
Evaluate the next user input. The input is read through stdin and the result is written
through stdout.
Auto Trait Implementations§
impl !Freeze for Repl
impl !RefUnwindSafe for Repl
impl Send for Repl
impl !Sync for Repl
impl Unpin for Repl
impl !UnwindSafe for Repl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more