pub struct TraceTableFragment<'a, B: StarkField> { /* private fields */ }
Expand description

A set of consecutive rows of an execution trace.

An execution trace fragment is a “view” into the specific execution trace. Updating data in the fragment, directly updates the data in the underlying execution trace.

A fragment cannot be instantiated directly but is created by executing TraceTable::fragments() method.

A fragment always contains contiguous rows, and the number of rows is guaranteed to be a power of two.

Implementations§

source§

impl<'a, B: StarkField> TraceTableFragment<'a, B>

source

pub fn index(&self) -> usize

Returns the index of this fragment.

source

pub fn offset(&self) -> usize

Returns the step at which the fragment starts in the context of the original execution trace.

source

pub fn length(&self) -> usize

Returns the number of rows in this execution trace fragment.

source

pub fn width(&self) -> usize

Returns the width of the fragment (same as the width of the underlying execution trace).

source

pub fn fill<I, T>(&mut self, init_state: I, update_state: T)
where I: FnOnce(&mut [B]), T: FnMut(usize, &mut [B]),

Fills all rows in the fragment.

The rows are filled by executing the provided closures as follows:

  • init closure is used to initialize the first row of the fragment; it receives a mutable reference to the first state initialized to all zeros. Contents of the state are copied into the first row of the fragment after the closure returns.
  • update closure is used to populate all subsequent rows of the fragment; it receives two parameters:
    • index of the last updated row (starting with 0).
    • a mutable reference to the last updated state; the contents of the state are copied into the next row of the fragment after the closure returns.
source

pub fn update_row(&mut self, row_idx: usize, row_data: &[B])

Updates a single row in the fragment with provided data.

Auto Trait Implementations§

§

impl<'a, B> RefUnwindSafe for TraceTableFragment<'a, B>
where B: RefUnwindSafe,

§

impl<'a, B> Send for TraceTableFragment<'a, B>

§

impl<'a, B> Sync for TraceTableFragment<'a, B>

§

impl<'a, B> Unpin for TraceTableFragment<'a, B>

§

impl<'a, B> !UnwindSafe for TraceTableFragment<'a, B>

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, 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.