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

Layout of columns within an execution trace.

A layout describes how columns of a trace are arranged into segments. All execution traces must have a non-zero main segment, and may have additional auxiliary trace segments. Currently, the number of auxiliary trace segments is limited to one.

Additionally, a layout contains information on how many random elements are required to build a given auxiliary trace segment. This information is used to construct AuxTraceRandElements struct which is passed in as one of the parameters to Air::evaluate_aux_transition() and Air::get_aux_assertions() methods.

The number of random elements may be different from the number of columns in a given auxiliary segment. For example, an auxiliary segment may contain just one column, but may require many random elements.

Implementations§

source§

impl TraceLayout

source

pub fn new( main_width: usize, aux_widths: [usize; 1], aux_rands: [usize; 1] ) -> TraceLayout

Returns a new TraceLayout instantiated with the provided info.

Panics

Panics if:

  • Width of the main trace segment is set to zero.
  • Sum of all segment widths exceeds 255.
  • A zero entry in auxiliary segment width array is followed by a non-zero entry.
  • Number of random elements for an auxiliary trace segment of non-zero width is set to zero.
  • Number of random elements for an auxiliary trace segment of zero width is set to non-zero.
  • Number of random elements for any auxiliary trace segment is greater than 255.
source

pub fn main_trace_width(&self) -> usize

Returns the number of columns in the main segment of an execution trace.

This is guaranteed to be between 1 and 255.

source

pub fn aux_trace_width(&self) -> usize

Returns the number of columns in all auxiliary segments of an execution trace.

source

pub fn num_segments(&self) -> usize

Returns the total number of segments in an execution trace.

source

pub fn num_aux_segments(&self) -> usize

Returns the number of auxiliary trace segments in an execution trace.

source

pub fn get_aux_segment_width(&self, segment_idx: usize) -> usize

Returns the number of columns in the auxiliary trace segment at the specified index.

source

pub fn get_aux_segment_rand_elements(&self, segment_idx: usize) -> usize

Returns the number of random elements required by the auxiliary trace segment at the specified index.

Trait Implementations§

source§

impl Clone for TraceLayout

source§

fn clone(&self) -> TraceLayout

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TraceLayout

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Deserializable for TraceLayout

source§

fn read_from<R>(source: &mut R) -> Result<TraceLayout, DeserializationError>
where R: ByteReader,

Reads TraceLayout from the specified source and returns the result.

Errors

Returns an error of a valid TraceLayout struct could not be read from the specified source.

source§

fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>

Attempts to deserialize the provided bytes into Self and returns the result. Read more
source§

fn read_batch_from<R>( source: &mut R, num_elements: usize ) -> Result<Vec<Self>, DeserializationError>
where R: ByteReader,

Reads a sequence of bytes from the provided source, attempts to deserialize these bytes into a vector with the specified number of Self elements, and returns the result. Read more
source§

impl PartialEq for TraceLayout

source§

fn eq(&self, other: &TraceLayout) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serializable for TraceLayout

source§

fn write_into<W>(&self, target: &mut W)
where W: ByteWriter,

Serializes self and writes the resulting bytes into the target.

source§

fn to_bytes(&self) -> Vec<u8>

Serializes self into a vector of bytes.
source§

fn write_batch_into<W>(source: &[Self], target: &mut W)
where W: ByteWriter,

Serializes all elements of the source and writes these bytes into the target. Read more
source§

fn get_size_hint(&self) -> usize

Returns an estimate of how many bytes are needed to represent self. Read more
source§

impl<E> ToElements<E> for TraceLayout
where E: StarkField,

source§

fn to_elements(&self) -> Vec<E>

source§

impl Eq for TraceLayout

source§

impl StructuralEq for TraceLayout

source§

impl StructuralPartialEq for TraceLayout

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.