Struct endbasic_std::MachineBuilder

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

Builder pattern to construct an EndBASIC interpreter.

Unless otherwise specified, the interpreter is connected to a terminal-based console.

Implementations§

source§

impl MachineBuilder

source

pub fn with_console(self, console: Rc<RefCell<dyn Console>>) -> Self

Overrides the default terminal-based console with the given one.

source

pub fn with_gpio_pins(self, pins: Rc<RefCell<dyn Pins>>) -> Self

Overrides the default hardware-based GPIO pins with the given ones.

source

pub fn with_sleep_fn(self, sleep_fn: SleepFn) -> Self

Overrides the default sleep function with the given one.

source

pub fn with_yield_now_fn(self, yield_now_fn: YieldNowFn) -> Self

Overrides the default yielding function with the given one.

source

pub fn with_signals_chan(self, chan: (Sender<Signal>, Receiver<Signal>)) -> Self

Overrides the default signals channel with the given one.

source

pub fn get_console(&mut self) -> Rc<RefCell<dyn Console>>

Lazily initializes the console field with a default value and returns it.

source

pub fn build(self) -> Result<Machine>

Builds the interpreter.

source

pub fn make_interactive(self) -> InteractiveMachineBuilder

Extends the machine with interactive (REPL) features.

Trait Implementations§

source§

impl Default for MachineBuilder

source§

fn default() -> MachineBuilder

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V