pub trait ReadMemory {
    // Required methods
    fn get(&self, addr: &Address) -> Option<&Primitive>;
    fn get_composite<T: Value>(
        &self,
        start: Address
    ) -> Result<(T, usize), MemoryError>;
    fn stack_pop(&mut self) -> Result<Vec<Primitive>, MemoryError>;
    fn stack_peek(&self) -> Result<Vec<Primitive>, MemoryError>;

    // Provided method
    fn get_ok(&self, address: &Address) -> Result<Vec<Primitive>, MemoryError> { ... }
}
Expand description

Memory that a KittyCAD Execution Plan can read from.

Required Methods§

source

fn get(&self, addr: &Address) -> Option<&Primitive>

Get a value from the given address.

source

fn get_composite<T: Value>( &self, start: Address ) -> Result<(T, usize), MemoryError>

Get a value from the given starting address. Value might require multiple addresses.

source

fn stack_pop(&mut self) -> Result<Vec<Primitive>, MemoryError>

Remove the value on top of the stack, return it.

source

fn stack_peek(&self) -> Result<Vec<Primitive>, MemoryError>

Return the value on top of the stack.

Provided Methods§

source

fn get_ok(&self, address: &Address) -> Result<Vec<Primitive>, MemoryError>

Same as get but match the return signature of stack operations.

Object Safety§

This trait is not object safe.

Implementors§