Struct endbasic_core::exec::Machine

source ·
pub struct Machine { /* private fields */ }
Expand description

Executes an EndBASIC program and tracks its state.

Implementations§

Constructs a new empty machine with the given signals communication channel.

Constructs a new empty machine with the given signals communication channel and yielding function.

Registers the given clearable.

In the common case, functions and commands hold a reference to the out-of-machine state they interact with. This state is invisible from here, but we may need to have access to it to reset it as part of the clear operation. In those cases, such state must be registered via this hook.

Registers the given builtin command, which must not yet be registered.

Registers the given builtin function, which must not yet be registered.

Obtains a channel via which to send signals to the machine during execution.

Resets the state of the machine by clearing all variable.

Obtains immutable access to the data values available during the current execution.

Obtains immutable access to the state of the symbols.

Obtains mutable access to the state of the symbols.

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

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

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

Handles an array definition. The array must not yet exist, and the name may not overlap function or variable names.

Consumes any pending signals so that they don’t interfere with an upcoming execution.

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§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.