pub struct Interpreter {
pub env: Environment,
pub output: Box<dyn OutputHandler>,
}Fields§
§env: Environment§output: Box<dyn OutputHandler>Implementations§
Source§impl Interpreter
impl Interpreter
Sourcepub fn with_output(handler: Box<dyn OutputHandler>) -> Self
pub fn with_output(handler: Box<dyn OutputHandler>) -> Self
Create an interpreter with a custom output handler.
Use StreamingOutput to stream
print/println output to a terminal in real-time, or provide any
other OutputHandler implementation.
Sourcepub fn output_lines(&self) -> &[String]
pub fn output_lines(&self) -> &[String]
Return all output lines emitted so far.
pub fn run(&mut self, program: &Node) -> Result<Value, RuntimeError>
pub fn eval(&mut self, expr: &Expr) -> Result<Value, RuntimeError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interpreter
impl !RefUnwindSafe for Interpreter
impl !Send for Interpreter
impl !Sync for Interpreter
impl Unpin for Interpreter
impl !UnwindSafe for Interpreter
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