Struct snarkvm_gadgets::bits::boolean::AllocatedBit
source · [−]pub struct AllocatedBit { /* private fields */ }
Expand description
Represents a variable in the constraint system which is guaranteed to be either zero or one.
Implementations
sourceimpl AllocatedBit
impl AllocatedBit
pub fn get_value(&self) -> Option<bool>
pub fn get_variable(&self) -> Variable
sourcepub fn and<F, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
pub fn and<F, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
Performs an AND operation over the two operands, returning
an AllocatedBit
.
sourcepub fn or<F, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
pub fn or<F, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
Performs an OR operation over the two operands, returning
an AllocatedBit
.
sourcepub fn and_not<F, CS>(
cs: CS,
a: &Self,
b: &Self
) -> Result<Self, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
pub fn and_not<F, CS>(
cs: CS,
a: &Self,
b: &Self
) -> Result<Self, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
Calculates a AND (NOT b)
.
sourcepub fn nor<F, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
pub fn nor<F, CS>(cs: CS, a: &Self, b: &Self) -> Result<Self, SynthesisError> where
F: Field,
CS: ConstraintSystem<F>,
Calculates (NOT a) AND (NOT b)
.
Trait Implementations
sourceimpl<F: Field> AllocGadget<bool, F> for AllocatedBit
impl<F: Field> AllocGadget<bool, F> for AllocatedBit
fn alloc<Fn, T, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError> where
Fn: FnOnce() -> Result<T, SynthesisError>,
T: Borrow<bool>,
fn alloc_input<Fn, T, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError> where
Fn: FnOnce() -> Result<T, SynthesisError>,
T: Borrow<bool>,
fn alloc_constant<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
_cs: CS,
_f: Fn
) -> Result<Self, SynthesisError>
fn alloc_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
fn alloc_input_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
sourceimpl Clone for AllocatedBit
impl Clone for AllocatedBit
sourcefn clone(&self) -> AllocatedBit
fn clone(&self) -> AllocatedBit
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<F: PrimeField> CondSelectGadget<F> for AllocatedBit
impl<F: PrimeField> CondSelectGadget<F> for AllocatedBit
fn conditionally_select<CS: ConstraintSystem<F>>(
cs: CS,
cond: &Boolean,
first: &Self,
second: &Self
) -> Result<Self, SynthesisError>
fn cost() -> usize
sourceimpl Debug for AllocatedBit
impl Debug for AllocatedBit
sourceimpl From<AllocatedBit> for Boolean
impl From<AllocatedBit> for Boolean
sourcefn from(b: AllocatedBit) -> Boolean
fn from(b: AllocatedBit) -> Boolean
Performs the conversion.
sourceimpl PartialEq<AllocatedBit> for AllocatedBit
impl PartialEq<AllocatedBit> for AllocatedBit
sourceimpl<F: Field> Xor<F, AllocatedBit> for AllocatedBit
impl<F: Field> Xor<F, AllocatedBit> for AllocatedBit
fn xor<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
impl Copy for AllocatedBit
impl Eq for AllocatedBit
Auto Trait Implementations
impl RefUnwindSafe for AllocatedBit
impl Send for AllocatedBit
impl Sync for AllocatedBit
impl Unpin for AllocatedBit
impl UnwindSafe for AllocatedBit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more