Struct endbasic_core::exec::Machine [−][src]
Executes an EndBASIC program and tracks its state.
Implementations
impl Machine
[src]
pub fn add_command(&mut self, command: Rc<dyn Command>)
[src]
Registers the given builtin command, which must not yet be registered.
pub fn add_function(&mut self, function: Rc<dyn Function>)
[src]
Registers the given builtin function, which must not yet be registered.
pub fn clear(&mut self)
[src]
Resets the state of the machine by clearing all variable.
pub fn exit(&mut self, code: u8)
[src]
Tells the machine to stop execution at the next statement boundary.
The exec()
call that's stopped by this invocation will return the code
given to this
call.
pub fn get_symbols(&self) -> &Symbols
[src]
Obtains immutable access to the state of the symbols.
pub fn get_mut_symbols(&mut self) -> &mut Symbols
[src]
Obtains mutable access to the state of the symbols.
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 fn dim_array(
&mut self,
name: &str,
subtype: &VarType,
dimensions: &[Expr]
) -> Result<()>
[src]
&mut self,
name: &str,
subtype: &VarType,
dimensions: &[Expr]
) -> Result<()>
Defines a new array name
of type subtype
with dimensions
. The array must not yet
exist, and the name may not overlap function or variable names.
pub async fn exec(&mut self, input: &mut dyn Read) -> Result<StopReason>
[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
Auto Trait Implementations
impl !RefUnwindSafe for Machine
[src]
impl !Send for Machine
[src]
impl !Sync for Machine
[src]
impl Unpin for Machine
[src]
impl !UnwindSafe for Machine
[src]
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>,