pub struct CasmBuilder { /* private fields */ }
Expand description

Builder to more easily write casm code without specifically thinking about ap changes and the sizes of opcodes. Wrong usages of it would panic instead of returning a result, as this builder assumes we are in a post validation of parameters stage.

Implementations§

Finalizes the builder, with the requested labels as the returning branches. “Fallthrough” is a special case for the fallthrough case.

Adds a variable pointing to value.

Allocates a new variable in memory, either local (FP-baser) or temp (AP-based).

Returns an additional variable pointing to the same value.

Adds a hint, generated from inputs which are cell refs or immediates and outputs which must be cell refs.

Adds an assertion that dst = res. dst must be a cell reference.

Writes and increments a buffer. Useful for RangeCheck and similar buffers. buffer must be a cell reference, or a cell reference with a small added constant. value must be a cell reference.

Increments a buffer and allocates and returns variable pointing to its previous value.

Increases AP by size.

Returns a variable that is the op of lhs and rhs. lhs must be a cell reference and rhs must be deref or immediate.

Returns a variable that is [[var] + offset]. var must be a cell reference, or a cell ref plus a small constant.

Add a statement to jump to label.

Add a statement to jump to label if condition != 0. condition must be a cell reference.

Adds a label here named name.

Rescoping the values, while ignoring all vars not stated in vars and giving the vars on the left side the values of the vars on the right side.

Adds a call command to ‘label’. All AP based variables are passed to the called function state and dropped from the calling function state.

A return statement in the code.

Trait Implementations§

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

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.