use crate::State; pub struct Repl<'a> { state: State<'a> } impl<'a> Repl<'a> { pub fn new(state: State<'a>) -> Self { Self { state } } pub fn run(&mut self) { let mut rl = rustyline::DefaultEditor::new().unwrap(); loop { let Ok(line) = rl.readline(">> ") else { break; }; if let Err(err) = self.state.execute(line) { crate::error(err); } } } }