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

A code block used to describe a linear sequence of operations (i.e., no branching or loops).

When the VM executes a Span block, it breaks the sequence of operations into batches and groups according to the following rules:

  • A group may contain up to 9 operations or a single immediate value.
  • An operation carrying an immediate value cannot be in the 9th position in a group.
  • A batch may contain up to 8 groups.
  • There is no limit on the number of batches contained within a single span.

Thus, for example, executing 8 pushes in a row will result in two operation batches:

  • The first batch will contain 8 groups, with the first group containing 7 push opcodes, and the remaining 7 groups containing immediate values for each of the push operations.
  • The second batch will contain 2 groups, with the first group containing a single push opcode, and the second group containing the immediate value for the last push operation.

If a sequence of operations does not have any operations which carry immediate values, then up to 72 operations can fit into a single batch.

TODO: describe how Span hash is computed.

Implementations

Returns a new Span block instantiated with the specified operations.

Errors (TODO)

Returns an error if:

  • operations vector is empty.
  • operations vector contains any number of system operations.

Returns a new Span block instantiated with the specified operations and decorators.

Errors (TODO)

Returns an error if:

  • operations vector is empty.
  • operations vector contains any number of system operations.

Returns a hash of this code block.

Returns list of operation batches contained in this span block.

Returns a new Span block instantiated with operations from this block repeated the specified number of times.

Returns a list of decorators in this span block

Returns a DecoratorIterator which allows us to iterate through the decorator list of this span block while executing operation batches of this span block

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. 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.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
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.