[][src]Struct endbasic_core::exec::Machine

pub struct Machine { /* fields omitted */ }

Executes an EndBASIC program and tracks its state.

Implementations

impl Machine[src]

pub fn clear(&mut self)[src]

Resets the state of the machine by clearing all variable.

pub fn get_builtins(&self) -> &HashMap<&'static str, Rc<dyn BuiltinCommand>>[src]

Obtains immutable access to the builtins supported by this machine.

pub fn get_vars(&self) -> &Vars[src]

Obtains immutable access to the state of the variables.

pub fn get_mut_vars(&mut self) -> &mut Vars[src]

Obtains mutable access to the state of the variables.

pub fn get_var_as_bool(&self, name: &str) -> Result<bool>[src]

Retrieves the variable name as a boolean. Fails if it is some other type or if it's not defined.

pub fn get_var_as_int(&self, name: &str) -> Result<i32>[src]

Retrieves the variable name as an integer. Fails if it is some other type or if it's not defined.

pub fn get_var_as_string(&self, name: &str) -> Result<&str>[src]

Retrieves the variable name as a string. Fails if it is some other type or if it's not defined.

pub async fn exec<'_, '_>(&'_ mut self, input: &'_ mut dyn Read) -> Result<()>[src]

Executes a program extracted from the input readable.

Note that this does not consume self. As a result, it is possible to execute multiple different programs on the same machine, all sharing state.

Trait Implementations

impl Default for Machine[src]

Auto Trait Implementations

impl !RefUnwindSafe for Machine

impl !Send for Machine

impl !Sync for Machine

impl Unpin for Machine

impl !UnwindSafe for Machine

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.