pub struct VarAllocator<T> { /* private fields */ }Expand description
Allocator for field variables.
Creates a new wire identifier when requested, and keeps tracks of the wires that have been declared as public.
Implementations§
Source§impl<T: Clone + Unit> VarAllocator<T>
impl<T: Clone + Unit> VarAllocator<T>
pub fn new() -> Self
pub fn new_field_var(&self) -> FieldVar
pub fn allocate_vars<const N: usize>(&self) -> [FieldVar; N]
pub fn allocate_vars_vec(&self, count: usize) -> Vec<FieldVar>
pub fn allocate_public<const N: usize>( &self, public_values: &[T; N], ) -> [FieldVar; N]
pub fn allocate_public_vec(&self, public_values: &[T]) -> Vec<FieldVar>
pub fn vars_count(&self) -> usize
pub fn is_allocated(&self, var: FieldVar) -> bool
Sourcepub fn set_public_var(&self, var: FieldVar, val: T)
pub fn set_public_var(&self, var: FieldVar, val: T)
Assigns the wire variable var to val.
If the wire was already present, it is over-written.
Sourcepub fn set_public_vars<Val, Var>(
&self,
vars: impl IntoIterator<Item = Var>,
vals: impl IntoIterator<Item = Val>,
)
pub fn set_public_vars<Val, Var>( &self, vars: impl IntoIterator<Item = Var>, vals: impl IntoIterator<Item = Val>, )
Sets a list of public variables.
Takes as input two iterators (for wires and values respectively), and sets each of them to public values.
§Panics
If the iterators have different length, this function will panic.
pub fn public_vars(&self) -> Vec<(FieldVar, T)>
Trait Implementations§
Source§impl<T: Clone> Clone for VarAllocator<T>
impl<T: Clone> Clone for VarAllocator<T>
Source§fn clone(&self) -> VarAllocator<T>
fn clone(&self) -> VarAllocator<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> !RefUnwindSafe for VarAllocator<T>
impl<T> !UnwindSafe for VarAllocator<T>
impl<T> Freeze for VarAllocator<T>
impl<T> Send for VarAllocator<T>
impl<T> Sync for VarAllocator<T>
impl<T> Unpin for VarAllocator<T>
impl<T> UnsafeUnpin for VarAllocator<T>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
Converts
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> ⓘ
Converts
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