pub struct OakRepl<H: ReplHandler> { /* private fields */ }Expand description
The main REPL engine.
OakRepl manages the terminal interface, handles user input,
and coordinates with a ReplHandler to provide language-specific
functionality.
§Example
use oak_repl::{HandleResult, OakRepl, ReplError, ReplHandler};
struct MyHandler;
impl ReplHandler for MyHandler {
fn prompt(&self, _: bool) -> &str {
"> "
}
fn is_complete(&self, code: &str) -> bool {
true
}
fn handle_line(&mut self, line: &str) -> Result<HandleResult, ReplError> {
println!("You typed: {}", line);
Ok(HandleResult::Continue)
}
}
let mut repl = OakRepl::new(MyHandler);
repl.run().expect("REPL failed");Implementations§
Source§impl<H: ReplHandler> OakRepl<H>
impl<H: ReplHandler> OakRepl<H>
Auto Trait Implementations§
impl<H> Freeze for OakRepl<H>where
H: Freeze,
impl<H> RefUnwindSafe for OakRepl<H>where
H: RefUnwindSafe,
impl<H> Send for OakRepl<H>where
H: Send,
impl<H> Sync for OakRepl<H>where
H: Sync,
impl<H> Unpin for OakRepl<H>where
H: Unpin,
impl<H> UnsafeUnpin for OakRepl<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for OakRepl<H>where
H: UnwindSafe,
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