pub struct AllocatedBool<F: Field> { /* private fields */ }
Expand description

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 AllocatedBool, as Boolean offers better support for constant values, and implements more traits.

Implementations§

Get the assigned value for self.

Get the R1CS variable for self.

Performs an XOR operation over the two operands, returning an AllocatedBool.

Performs an AND operation over the two operands, returning an AllocatedBool.

Performs an OR operation over the two operands, returning an AllocatedBool.

Calculates a AND (NOT b).

Calculates (NOT a) AND (NOT b).

Trait Implementations§

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!

Allocates a new constant of type Self in the ConstraintSystem cs. Read more
Allocates a new public input of type Self in the ConstraintSystem cs.
Allocates a new private witness of type Self in the ConstraintSystem cs.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
If cond == &Boolean::TRUE, then this returns true_value; else, returns false_value. Read more
Returns an element of values whose index in represented by position. position is an array of boolean that represents an unsigned integer in big endian order. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Checks if this value is equivalent to the given key. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more