pub struct VMBuilder<T: BrainfuckCell = u8, A: BrainfuckAllocator = DynamicAllocator, R: Read = Stdin, W: Write = Stdout> { /* private fields */ }
Expand description
A builder struct for the default implementation of BrainfuckVM
Create the default configuration with VMBuilder::new()
or VMBuilder::default()
,
customize with the member functions, and build the final VM with VMBuilder::build()
Implementations§
source§impl<T: BrainfuckCell + 'static, A: BrainfuckAllocator + 'static, R: Read + 'static, W: Write + 'static> VMBuilder<T, A, R, W>
impl<T: BrainfuckCell + 'static, A: BrainfuckAllocator + 'static, R: Read + 'static, W: Write + 'static> VMBuilder<T, A, R, W>
sourcepub fn with_cell_type<U: BrainfuckCell>(self) -> VMBuilder<U, A, R, W>
pub fn with_cell_type<U: BrainfuckCell>(self) -> VMBuilder<U, A, R, W>
Changes the type of the memory cells to U
sourcepub fn with_allocator<U: BrainfuckAllocator>(self) -> VMBuilder<T, U, R, W>
pub fn with_allocator<U: BrainfuckAllocator>(self) -> VMBuilder<T, U, R, W>
Changes the used allocator to U
sourcepub fn with_preallocated_cells(
self,
num_preallocated: usize
) -> VMBuilder<T, A, R, W>
pub fn with_preallocated_cells( self, num_preallocated: usize ) -> VMBuilder<T, A, R, W>
Changes the amount of pre-allocated cells to num_preallocated
sourcepub fn with_reader<U: Read>(self, reader: U) -> VMBuilder<T, A, U, W>
pub fn with_reader<U: Read>(self, reader: U) -> VMBuilder<T, A, U, W>
Changes the reader used by the VM as input for the running Brainfuck
programs to reader
sourcepub fn with_writer<U: Write>(self, writer: U) -> VMBuilder<T, A, R, U>
pub fn with_writer<U: Write>(self, writer: U) -> VMBuilder<T, A, R, U>
Changes the writer used by the VM as output for the running Brainfuck programs
to writer
sourcepub fn build(self) -> Box<dyn BrainfuckVM>
pub fn build(self) -> Box<dyn BrainfuckVM>
Builds the BrainfuckVM
with the currently
stored configuration of this builder
Trait Implementations§
Auto Trait Implementations§
impl<T, A, R, W> Freeze for VMBuilder<T, A, R, W>
impl<T, A, R, W> RefUnwindSafe for VMBuilder<T, A, R, W>
impl<T, A, R, W> Send for VMBuilder<T, A, R, W>
impl<T, A, R, W> Sync for VMBuilder<T, A, R, W>
impl<T, A, R, W> Unpin for VMBuilder<T, A, R, W>
impl<T, A, R, W> UnwindSafe for VMBuilder<T, A, R, W>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more