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_value_as_field_element<E: Engine>(&self) -> Option<E::Fr>
pub fn get_variable(&self) -> Variable
Sourcepub fn alloc_conditionally<E, CS>(
cs: &mut CS,
value: Option<bool>,
must_be_false: &AllocatedBit,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn alloc_conditionally<E, CS>(
cs: &mut 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: &mut CS,
value: Option<bool>,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn alloc<E, CS>(
cs: &mut 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.
pub fn from_allocated_num_unchecked<E: Engine>(num: AllocatedNum<E>) -> Self
Sourcepub fn xor<E, CS>(
cs: &mut CS,
a: &Self,
b: &Self,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn xor<E, CS>(
cs: &mut 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: &mut CS,
a: &Self,
b: &Self,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn and<E, CS>(
cs: &mut 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 or<E, CS>(
cs: &mut CS,
a: &Self,
b: &Self,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn or<E, CS>(
cs: &mut CS,
a: &Self,
b: &Self,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
Performs an OR operation over the two operands, returning
an AllocatedBit
.
Sourcepub fn and_not<E, CS>(
cs: &mut CS,
a: &Self,
b: &Self,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn and_not<E, CS>(
cs: &mut 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: &mut CS,
a: &Self,
b: &Self,
) -> Result<Self, SynthesisError>where
E: Engine,
CS: ConstraintSystem<E>,
pub fn nor<E, CS>(
cs: &mut 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 copy 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 Debug for AllocatedBit
impl Debug for AllocatedBit
Source§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.
impl Copy for AllocatedBit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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