Struct winterfell::TraceTableFragment
source · [−]pub struct TraceTableFragment<'a, B> where
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
sourceimpl<'a, B> TraceTableFragment<'a, B> where
B: StarkField,
impl<'a, B> TraceTableFragment<'a, B> where
B: StarkField,
sourcepub fn offset(&self) -> usize
pub fn offset(&self) -> usize
Returns the step at which the fragment starts in the context of the original execution trace.
sourcepub fn width(&self) -> usize
pub fn width(&self) -> usize
Returns the width of the fragment (same as the width of the underlying execution trace).
sourcepub fn fill<I, T>(&mut self, init_state: I, update_state: T) where
I: Fn(&mut [B]),
T: Fn(usize, &mut [B]),
pub fn fill<I, T>(&mut self, init_state: I, update_state: T) where
I: Fn(&mut [B]),
T: Fn(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.
sourcepub fn update_row(&mut self, row_idx: usize, row_data: &[B])
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
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