pub struct AllocatedBit { /* private fields */ }Expand description
Represents a variable in the constraint system which is guaranteed to be either zero or one.
Implementations§
Source§impl AllocatedBit
impl AllocatedBit
pub fn get_value(&self) -> Option<bool>
pub fn get_variable(&self) -> Variable
Sourcepub fn alloc_conditionally<E, CS>(
cs: CS,
value: Option<bool>,
must_be_false: &AllocatedBit,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn alloc_conditionally<E, CS>(
cs: CS,
value: Option<bool>,
must_be_false: &AllocatedBit,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
Allocate a variable in the constraint system which can only be a boolean value. Further, constrain that the boolean is false unless the condition is false.
Sourcepub fn alloc<E, CS>(cs: CS, value: Option<bool>) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn alloc<E, CS>(cs: CS, value: Option<bool>) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
Allocate a variable in the constraint system which can only be a boolean value.
Sourcepub fn xor<E, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn xor<E, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
Performs an XOR operation over the two operands, returning
an AllocatedBit.
Sourcepub fn and<E, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn and<E, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
Performs an AND operation over the two operands, returning
an AllocatedBit.
Sourcepub fn and_not<E, CS>(
cs: CS,
a: &Self,
b: &Self,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn and_not<E, CS>(
cs: CS,
a: &Self,
b: &Self,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
Calculates a AND (NOT b).
Sourcepub fn nor<E, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn nor<E, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
Calculates (NOT a) AND (NOT b).
Trait Implementations§
Source§impl Clone for AllocatedBit
impl Clone for AllocatedBit
Source§fn clone(&self) -> AllocatedBit
fn clone(&self) -> AllocatedBit
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl From<AllocatedBit> for Boolean
impl From<AllocatedBit> for Boolean
Source§fn from(b: AllocatedBit) -> Boolean
fn from(b: AllocatedBit) -> Boolean
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for AllocatedBit
impl RefUnwindSafe for AllocatedBit
impl Send for AllocatedBit
impl Sync for AllocatedBit
impl Unpin for AllocatedBit
impl UnwindSafe for AllocatedBit
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