pub trait BrainfuckAllocator {
    // Required method
    fn ensure_capacity<T: BrainfuckCell>(
        data: &mut Vec<T>,
        min_size: usize
    ) -> Result<(), VMMemoryError>;
}
Expand description

A trait representing an object that is capable of allocating memory for a Brainfuck VM

Required Methods§

source

fn ensure_capacity<T: BrainfuckCell>( data: &mut Vec<T>, min_size: usize ) -> Result<(), VMMemoryError>

Ensures that data has at least min_size cells available for both reading and writing. If this function returns Result::Ok, data[min_size - 1] can be safely read from and written to.

Any new cells created by this function shall be initialized to the default value of T

Object Safety§

This trait is not object safe.

Implementors§