pub struct Interpreter { /* private fields */ }
Expand description
The interpreter used for running whitespace
Implementations§
Source§impl Interpreter
impl Interpreter
Sourcepub fn new(code: String, print_instructions: bool) -> Interpreter
pub fn new(code: String, print_instructions: bool) -> Interpreter
Create an Interpreter from a source code passed as the argument
The print_instructions parameter prints the instructions. This should be set to True when debugging the code
§Example
let source = String::from(" \t\t\n");
let interpreter = Interpreter::new(source, false);
Sourcepub fn from_file(file: &str, print_instructions: bool) -> Option<Interpreter>
pub fn from_file(file: &str, print_instructions: bool) -> Option<Interpreter>
Initialize an interpreter from a file
The print_instructions parameter prints the instructions. This should be set to True when debugging the code
§Example
let interpreter = Interpreter::from_file("main.ws", false);
Sourcepub fn write(&mut self, num: i32)
pub fn write(&mut self, num: i32)
Write a value on top of the stack Should be used when the Status is set to ReadChar/ReadInt
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