pub struct ValueVecLayout {
pub n_const: usize,
pub n_inout: usize,
pub n_witness: usize,
pub n_internal: usize,
pub n_scratch: usize,
}Expand description
Description of a layout of the value vector for a particular circuit.
This is the compiler’s view of the value vector: it names every section the circuit allocates,
including the ones a ConstraintSystem has no interest in — the split of the private segment
into declared witness and gate-created internal values, and the scratch tail used only while
evaluating the circuit.
The sections are stored back to back, with no padding between them:
[ constants | inout ][ witness | internal ][ scratch ]
\-- public values -/ \--- private values -/The proving protocol pads the two committed segments to the widths its reductions need, which
ConstraintSystem derives; none of that padding is stored here.
Fields§
§n_const: usizeThe number of the constants declared by the circuit.
n_inout: usizeThe number of the input output parameters declared by the circuit.
n_witness: usizeThe number of the witness parameters declared by the circuit.
n_internal: usizeThe number of the internal values declared by the circuit.
Those are outputs and intermediaries created by the gates.
n_scratch: usizeThe number of scratch values at the end of the value vec.
Implementations§
Source§impl ValueVecLayout
impl ValueVecLayout
Sourcepub const fn offset_inout(&self) -> usize
pub const fn offset_inout(&self) -> usize
Returns the word at which the inout values start.
Sourcepub const fn offset_witness(&self) -> usize
pub const fn offset_witness(&self) -> usize
Returns the word at which the private values start, which is where the public ones end.
Sourcepub const fn n_private(&self) -> usize
pub const fn n_private(&self) -> usize
Returns the number of private values: the declared witness values followed by the gate-created internal ones, which share the segment.
Sourcepub const fn combined_len(&self) -> usize
pub const fn combined_len(&self) -> usize
Returns the combined number of public and private values, excluding scratch.
This is the length of the value vector prefix that constraint operands can reference.
Sourcepub const fn word_offset(&self, index: ValueIndex) -> usize
pub const fn word_offset(&self, index: ValueIndex) -> usize
Returns the flat position of the word a ValueIndex names, counting the scratch tail.
Sourcepub fn constraint_system_shape(&self, constants: Vec<Word>) -> ConstraintSystem
pub fn constraint_system_shape(&self, constants: Vec<Word>) -> ConstraintSystem
Returns the constraint system shape this layout realizes.
The returned system has no constraints; the caller fills them in.
§Panics
Panics if the constant count does not match the layout’s.
Trait Implementations§
Source§impl Clone for ValueVecLayout
impl Clone for ValueVecLayout
Source§fn clone(&self) -> ValueVecLayout
fn clone(&self) -> ValueVecLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValueVecLayout
impl Debug for ValueVecLayout
Source§impl PartialEq for ValueVecLayout
impl PartialEq for ValueVecLayout
Source§fn eq(&self, other: &ValueVecLayout) -> bool
fn eq(&self, other: &ValueVecLayout) -> bool
self and other values to be equal, and is used by ==.impl Eq for ValueVecLayout
impl StructuralPartialEq for ValueVecLayout
Auto Trait Implementations§
impl Freeze for ValueVecLayout
impl RefUnwindSafe for ValueVecLayout
impl Send for ValueVecLayout
impl Sync for ValueVecLayout
impl Unpin for ValueVecLayout
impl UnsafeUnpin for ValueVecLayout
impl UnwindSafe for ValueVecLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more