Struct winterfell::TraceLayout
[−]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
impl TraceLayout
impl TraceLayout
pub fn new(
main_width: usize,
aux_widths: [usize; 1],
aux_rands: [usize; 1]
) -> TraceLayout
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.
pub 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.
pub 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.
pub fn num_segments(&self) -> usize
pub fn num_segments(&self) -> usize
Returns the total number of segments in an execution trace.
pub fn num_aux_segments(&self) -> usize
pub fn num_aux_segments(&self) -> usize
Returns the number of auxiliary trace segments in an execution trace.
pub 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.
pub 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
impl Clone for TraceLayout
impl Clone for TraceLayout
fn clone(&self) -> TraceLayout
fn clone(&self) -> TraceLayout
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for TraceLayout
impl Debug for TraceLayout
impl Deserializable for TraceLayout
impl Deserializable for TraceLayout
fn read_from<R>(source: &mut R) -> Result<TraceLayout, DeserializationError> where
R: ByteReader,
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
.
fn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self, Global>, DeserializationError> where
R: ByteReader,
fn read_batch_from<R>(
source: &mut R,
num_elements: usize
) -> Result<Vec<Self, Global>, 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
impl PartialEq<TraceLayout> for TraceLayout
impl PartialEq<TraceLayout> for TraceLayout
fn eq(&self, other: &TraceLayout) -> bool
fn eq(&self, other: &TraceLayout) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &TraceLayout) -> bool
fn ne(&self, other: &TraceLayout) -> bool
This method tests for !=
.
impl Serializable for TraceLayout
impl Serializable for TraceLayout
fn write_into<W>(&self, target: &mut W) where
W: ByteWriter,
fn write_into<W>(&self, target: &mut W) where
W: ByteWriter,
Serializes self
and writes the resulting bytes into the target
.
fn write_batch_into<W>(source: &[Self], target: &mut W) where
W: ByteWriter,
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
fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self. Read more
impl Eq for TraceLayout
impl StructuralEq for TraceLayout
impl StructuralPartialEq for TraceLayout
Auto Trait Implementations
impl RefUnwindSafe for TraceLayout
impl Send for TraceLayout
impl Sync for TraceLayout
impl Unpin for TraceLayout
impl UnwindSafe for TraceLayout
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more