[−][src]Struct bf_lib::Exec
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
impl Exec[src]
pub fn prog(prog: &str) -> Exec[src]
Contructs a new Exec, configured to run prog.
By default it will be run without input, timeout or temporary file path (defaults to cwd).
pub fn input(self, input: Option<String>) -> Exec[src]
Sets the input for the program.
pub fn timeout(self, time: Option<Duration>) -> Exec[src]
Sets the timeout for the program.
pub fn tmpdir(self, tmp_path: Option<PathBuf>) -> Exec[src]
Sets the temporary file path for the transpiler.
pub fn run(self) -> Result<String, Error>[src]
Wrapper for the transpile and interpret methods:
uses the faster transpiler when rustc is detected, falls back to interpreting the code.
pub fn interpret(self) -> Result<String, Error>[src]
Runs the program with the interpreter, returning the output or an Error.
pub fn transpile(self) -> Result<String, Error>[src]
Runs the program with the transpiler, returning the output or an Error.
Needs read and write permission in the chosen temporary file folder.
pub fn translate(&self) -> Result<String, Error>[src]
Translated the program to rust code
Auto Trait Implementations
impl RefUnwindSafe for Exec
impl Send for Exec
impl Sync for Exec
impl Unpin for Exec
impl UnwindSafe for Exec
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,