pub struct Exec { /* private fields */ }Expand description
Interface for running brainfuck code.
The prog method returns an instance with the default options (no timeout, input or
temporary file path)
input, timeout and tmpdir are used to change the default values, the program can
then be run by calling run, transpile or interpret.
let prog = "++++++++++[>++++++++++>+++++++++++<<-]>++.>+..";
let output = Exec::prog(prog).run().unwrap();
assert_eq!(String::from("foo"), output);Implementations§
Source§impl Exec
impl Exec
Sourcepub fn prog(prog: &str) -> Exec
pub fn prog(prog: &str) -> Exec
Contructs a new Exec, configured to run prog.
By default it will be run without input, timeout or temporary file path (defaults to cwd).
Sourcepub fn tmpdir(self, tmp_path: Option<PathBuf>) -> Exec
pub fn tmpdir(self, tmp_path: Option<PathBuf>) -> Exec
Sets the temporary file path for the transpiler.
Sourcepub fn interpret(self) -> Result<String, Error>
pub fn interpret(self) -> Result<String, Error>
Runs the program with the interpreter, returning the output or an Error.
Auto Trait Implementations§
impl Freeze for Exec
impl RefUnwindSafe for Exec
impl Send for Exec
impl Sync for Exec
impl Unpin for Exec
impl UnwindSafe for Exec
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