Enum snarkvm_wasm::traits::utilities::boolean::Boolean[][src]

pub enum Boolean {
    Is(AllocatedBit),
    Not(AllocatedBit),
    Constant(bool),
}

This is a boolean value which may be either a constant or an interpretation of an AllocatedBit.

Variants

Existential view of the boolean variable

Negated view of the boolean variable

Constant(bool)

Constant (not an allocated variable)

Implementations

impl Boolean[src]

pub fn get_value(&self) -> Option<bool>[src]

pub fn lc<F>(&self, one: Variable, coeff: F) -> LinearCombination<F> where
    F: Field
[src]

pub fn constant_u8_vec<F, CS>(
    cs: &mut CS,
    values: &[u8]
) -> Vec<Boolean, Global> where
    CS: ConstraintSystem<F>,
    F: Field
[src]

Construct a boolean vector from a vector of u8

pub fn constant(b: bool) -> Boolean[src]

Construct a boolean from a known constant.

pub fn not(&self) -> Boolean[src]

Return a negated interpretation of this boolean.

pub fn xor<F, CS>(
    cs: CS,
    a: &'a Boolean,
    b: &'a Boolean
) -> Result<Boolean, SynthesisError> where
    CS: ConstraintSystem<F>,
    F: Field
[src]

Perform XOR over two boolean operands.

pub fn or<F, CS>(
    cs: CS,
    a: &'a Boolean,
    b: &'a Boolean
) -> Result<Boolean, SynthesisError> where
    CS: ConstraintSystem<F>,
    F: Field
[src]

Perform OR over two boolean operands.

pub fn and<F, CS>(
    cs: CS,
    a: &'a Boolean,
    b: &'a Boolean
) -> Result<Boolean, SynthesisError> where
    CS: ConstraintSystem<F>,
    F: Field
[src]

Perform AND over two boolean operands.

pub fn kary_and<F, CS>(
    cs: CS,
    bits: &[Boolean]
) -> Result<Boolean, SynthesisError> where
    CS: ConstraintSystem<F>,
    F: Field
[src]

Perform AND over all the given boolean operands.

pub fn enforce_nand<F, CS>(
    cs: CS,
    bits: &[Boolean]
) -> Result<(), SynthesisError> where
    CS: ConstraintSystem<F>,
    F: Field
[src]

Asserts that at least one operand is false.

pub fn enforce_in_field<F, CS, NativeF>(
    cs: CS,
    bits: &[Boolean]
) -> Result<(), SynthesisError> where
    CS: ConstraintSystem<F>,
    F: Field,
    NativeF: PrimeField
[src]

Asserts that this bit_gadget representation is “in the field” when interpreted in big endian.

Trait Implementations

impl<F> AllocGadget<bool, F> for Boolean where
    F: Field
[src]

impl Clone for Boolean[src]

impl<F> CondSelectGadget<F> for Boolean where
    F: PrimeField
[src]

impl<F> ConditionalEqGadget<F> for Boolean where
    F: Field
[src]

impl Copy for Boolean[src]

impl Debug for Boolean[src]

impl Eq for Boolean[src]

impl<F> EqGadget<F> for Boolean where
    F: Field
[src]

impl<F> EvaluateEqGadget<F> for Boolean where
    F: PrimeField
[src]

a == b = !(a XOR b)

impl From<AllocatedBit> for Boolean[src]

impl<'a, F> FullAdder<'a, F> for Boolean where
    F: Field
[src]

impl PartialEq<Boolean> for Boolean[src]

impl SignExtend for Boolean[src]

impl<F> ToBitsGadget<F> for Boolean where
    F: Field
[src]

impl<F> ToBytesGadget<F> for Boolean where
    F: Field
[src]

pub fn to_bytes_strict<CS>(
    &self,
    cs: CS
) -> Result<Vec<UInt8, Global>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Additionally checks if the produced list of booleans is ‘valid’.

Auto Trait Implementations

impl RefUnwindSafe for Boolean

impl Send for Boolean

impl Sync for Boolean

impl Unpin for Boolean

impl UnwindSafe for Boolean

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<F, T> ConditionalOrEqualsGadget<F> for T where
    T: ConditionalEqGadget<F> + CondSelectGadget<F>,
    F: Field
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

impl<F, T> OrEqualsGadget<F> for T where
    T: ConditionalOrEqualsGadget<F>,
    F: Field
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

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>,