Struct whitespacers::Interpreter
source · pub struct Interpreter<'a> { /* private fields */ }
Expand description
A whitespace interpreter. This struct provides various strategies for interpreting a whitespace program.
Implementations§
source§impl<'a> Interpreter<'a>
impl<'a> Interpreter<'a>
sourcepub fn new(
program: &'a Program,
options: Options,
input: &'a mut (dyn BufRead + 'a),
output: &'a mut (dyn Write + 'a)
) -> Interpreter<'a>
pub fn new( program: &'a Program, options: Options, input: &'a mut (dyn BufRead + 'a), output: &'a mut (dyn Write + 'a) ) -> Interpreter<'a>
Construct a new whitespace interpreter from a program, input stream and output stream with the specified options.
sourcepub fn count_with_simple_state(&'a mut self) -> Result<usize, WsError>
pub fn count_with_simple_state(&'a mut self) -> Result<usize, WsError>
Similar to Interpreter::interpret_with_simple_state but does not have bigint fallback and returns the amount of executed instructions on success.
sourcepub fn interpret_with_simple_state(&'a mut self) -> Result<(), WsError>
pub fn interpret_with_simple_state(&'a mut self) -> Result<(), WsError>
The reference interpreter implementation. It uses simple data structures internally, falling back to bignum-based simple datastructures if values become too large.
sourcepub fn interpret_with_fast_state(&'a mut self) -> Result<(), WsError>
pub fn interpret_with_fast_state(&'a mut self) -> Result<(), WsError>
Interprets the program with optimized data structures, falling back to bignum-based simple datastructures if values become too large.
sourcepub fn interpret_with_bigint_state(&'a mut self) -> Result<(), WsError>
pub fn interpret_with_bigint_state(&'a mut self) -> Result<(), WsError>
Interpret the program using only bignum-based simple datastructures. This is slow.
sourcepub fn jit_aot(&mut self) -> Result<(), WsError>
pub fn jit_aot(&mut self) -> Result<(), WsError>
Use a jit compiler that compiles the entire program in advance to execute the program. It is backed by an optimized datastructure, and will fall back to interpretation in unsafe situations. When values become too large it will fall back to bignum-based interpretation.
sourcepub fn jit_sync(&mut self) -> Result<(), WsError>
pub fn jit_sync(&mut self) -> Result<(), WsError>
Use a jit compiler that compiles code synchronously while executing the program. It is backed by an optimized datastructure, and will fall back to interpretation in unsafe situations. When values become too large it will fall back to bignum-based interpretation.
sourcepub fn jit_threaded(&mut self) -> Result<(), WsError>
pub fn jit_threaded(&mut self) -> Result<(), WsError>
Use a jit compiler that compiles the program in a separate thread while executing the program. It is backed by an optimized datastructure, and will fall back to interpretation in unsafe situations. When values become too large it will fall back to bignum-based interpretation.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Interpreter<'a>
impl<'a> !Send for Interpreter<'a>
impl<'a> !Sync for Interpreter<'a>
impl<'a> Unpin for Interpreter<'a>
impl<'a> !UnwindSafe for Interpreter<'a>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more