[−][src]Struct endbasic_core::exec::Machine
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_commands(&self) -> &HashMap<&'static str, Rc<dyn BuiltinCommand>>
[src]
Obtains immutable access to the builtin commands provided by this machine.
pub fn get_functions(&self) -> &HashMap<&'static str, Rc<dyn BuiltinFunction>>
[src]
Obtains immutable access to the builtin functions provided 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
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>,