tasm_lib::traits::function

Trait Function

Source
pub trait Function: BasicSnippet {
    // Required methods
    fn rust_shadow(
        &self,
        stack: &mut Vec<BFieldElement>,
        memory: &mut HashMap<BFieldElement, BFieldElement>,
    );
    fn pseudorandom_initial_state(
        &self,
        seed: [u8; 32],
        bench_case: Option<BenchmarkCase>,
    ) -> FunctionInitialState;

    // Provided method
    fn corner_case_initial_states(&self) -> Vec<FunctionInitialState> { ... }
}
Expand description

A function can modify stack and extend memory.

A Function is a piece of tasm code that can modify the top of the stack, and can read and even extend memory. Specifically: any memory writes have to happen to addresses larger than the dynamic memory allocator and the dynamic memory allocator value has to be updated accordingly.

See also: closure, algorithm, read_only_algorithm, procedure, accessor, mem_preserver,

Required Methods§

Source

fn rust_shadow( &self, stack: &mut Vec<BFieldElement>, memory: &mut HashMap<BFieldElement, BFieldElement>, )

Source

fn pseudorandom_initial_state( &self, seed: [u8; 32], bench_case: Option<BenchmarkCase>, ) -> FunctionInitialState

Return (init_stack, init_memory)

Provided Methods§

Implementors§