Struct ark_r1cs_std::bits::boolean::AllocatedBit [−][src]
Represents a variable in the constraint system which is guaranteed to be either zero or one.
In general, one should prefer using Boolean instead of AllocatedBit,
as Boolean offers better support for constant values, and implements
more traits.
Implementations
impl<F: Field> AllocatedBit<F>[src]
pub fn value(&self) -> Result<bool, SynthesisError>[src]
Get the assigned value for self.
pub fn variable(&self) -> Variable[src]
Get the R1CS variable for self.
pub fn xor(&self, b: &Self) -> Result<Self, SynthesisError>[src]
Performs an XOR operation over the two operands, returning
an AllocatedBit.
pub fn and(&self, b: &Self) -> Result<Self, SynthesisError>[src]
Performs an AND operation over the two operands, returning
an AllocatedBit.
pub fn or(&self, b: &Self) -> Result<Self, SynthesisError>[src]
Performs an OR operation over the two operands, returning
an AllocatedBit.
pub fn and_not(&self, b: &Self) -> Result<Self, SynthesisError>[src]
Calculates a AND (NOT b).
pub fn nor(&self, b: &Self) -> Result<Self, SynthesisError>[src]
Calculates (NOT a) AND (NOT b).
Trait Implementations
impl<F: Field> AllocVar<bool, F> for AllocatedBit<F>[src]
fn new_variable<T: Borrow<bool>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>[src]
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>,
mode: AllocationMode
) -> Result<Self, SynthesisError>
Produces a new variable of the appropriate kind (instance or witness), with a booleanity check.
N.B.: we could omit the booleanity check when allocating self
as a new public input, but that places an additional burden on
protocol designers. Better safe than sorry!
fn new_constant(
cs: impl Into<Namespace<F>>,
t: impl Borrow<V>
) -> Result<Self, SynthesisError>[src]
cs: impl Into<Namespace<F>>,
t: impl Borrow<V>
) -> Result<Self, SynthesisError>
fn new_input<T: Borrow<V>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>[src]
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>
fn new_witness<T: Borrow<V>>(
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>[src]
cs: impl Into<Namespace<F>>,
f: impl FnOnce() -> Result<T, SynthesisError>
) -> Result<Self, SynthesisError>
impl<F: Clone + Field> Clone for AllocatedBit<F>[src]
fn clone(&self) -> AllocatedBit<F>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<F: Field> CondSelectGadget<F> for AllocatedBit<F>[src]
fn conditionally_select(
cond: &Boolean<F>,
true_val: &Self,
false_val: &Self
) -> Result<Self, SynthesisError>[src]
cond: &Boolean<F>,
true_val: &Self,
false_val: &Self
) -> Result<Self, SynthesisError>
fn conditionally_select_power_of_two_vector(
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>[src]
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>
impl<F: Debug + Field> Debug for AllocatedBit<F>[src]
impl<F: Eq + Field> Eq for AllocatedBit<F>[src]
impl<F: Field> From<AllocatedBit<F>> for Boolean<F>[src]
fn from(b: AllocatedBit<F>) -> Self[src]
impl<F: PartialEq + Field> PartialEq<AllocatedBit<F>> for AllocatedBit<F>[src]
fn eq(&self, other: &AllocatedBit<F>) -> bool[src]
fn ne(&self, other: &AllocatedBit<F>) -> bool[src]
impl<F: Field> StructuralEq for AllocatedBit<F>[src]
impl<F: Field> StructuralPartialEq for AllocatedBit<F>[src]
Auto Trait Implementations
impl<F> !RefUnwindSafe for AllocatedBit<F>
impl<F> !Send for AllocatedBit<F>
impl<F> !Sync for AllocatedBit<F>
impl<F> Unpin for AllocatedBit<F>
impl<F> !UnwindSafe for AllocatedBit<F>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>[src]
pub fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,