Struct ark_r1cs_std::bits::boolean::AllocatedBit[][src]

#[must_use]pub struct AllocatedBit<F: Field> { /* fields omitted */ }

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]

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!

impl<F: Clone + Field> Clone for AllocatedBit<F>[src]

impl<F: Field> CondSelectGadget<F> for AllocatedBit<F>[src]

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]

impl<F: PartialEq + Field> PartialEq<AllocatedBit<F>> for AllocatedBit<F>[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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,