Struct winter_air::TraceLayout
source · 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
impl TraceLayout
sourcepub fn new(
main_width: usize,
aux_widths: [usize; 1],
aux_rands: [usize; 1]
) -> Self
pub fn new( main_width: usize, aux_widths: [usize; 1], aux_rands: [usize; 1] ) -> Self
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.
sourcepub fn main_trace_width(&self) -> usize
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.
sourcepub fn aux_trace_width(&self) -> usize
pub fn aux_trace_width(&self) -> usize
Returns the number of columns in all auxiliary segments of an execution trace.
sourcepub fn num_segments(&self) -> usize
pub fn num_segments(&self) -> usize
Returns the total number of segments in an execution trace.
sourcepub fn num_aux_segments(&self) -> usize
pub fn num_aux_segments(&self) -> usize
Returns the number of auxiliary trace segments in an execution trace.
sourcepub fn get_aux_segment_width(&self, segment_idx: usize) -> usize
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.
sourcepub fn get_aux_segment_rand_elements(&self, segment_idx: usize) -> usize
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
impl Clone for TraceLayout
source§fn clone(&self) -> TraceLayout
fn clone(&self) -> TraceLayout
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for TraceLayout
impl Debug for TraceLayout
source§impl Deserializable for TraceLayout
impl Deserializable for TraceLayout
source§fn read_from<R: ByteReader>(
source: &mut R
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R ) -> Result<Self, DeserializationError>
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>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
source§impl PartialEq for TraceLayout
impl PartialEq for TraceLayout
source§fn eq(&self, other: &TraceLayout) -> bool
fn eq(&self, other: &TraceLayout) -> bool
self and other values to be equal, and is used
by ==.source§impl Serializable for TraceLayout
impl Serializable for TraceLayout
source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
Serializes self and writes the resulting bytes into the target.