[][src]Struct r1cs::BinaryExpression

pub struct BinaryExpression<F: Field> {
    pub bits: Vec<BooleanExpression<F>>,
}

A BinaryExpression is comprised of several bits, each one being a BooleanExpression.

The sequence of bits is often interpreted as an unsigned integer for the purpose of binary arithmetic. When doing so, our convention is to treat the left-most bit as the least significant, and the right-most bit as the most significant.

Fields

bits: Vec<BooleanExpression<F>>

The sequence of bits, ordered from least significant to most significant.

Methods

impl<F: Field> BinaryExpression<F>[src]

pub fn len(&self) -> usize[src]

The number of bits.

pub fn zero() -> Self[src]

pub fn truncate(&mut self, l: usize)[src]

Truncate the bits in this expression, discarding the more significant bits while keeping the less significant bits.

pub fn truncated(&self, l: usize) -> Self[src]

Return a copy of this expression truncated to l bits, discarding the more significant bits while keeping the less significant bits.

pub fn pad(&mut self, l: usize)[src]

Pad this bit vector, adding 0 bits on the more significant side.

pub fn padded(&self, l: usize) -> Self[src]

Return a copy this bit vector, with 0 bits added on the more significant side.

pub fn chunks(&self, chunk_bits: usize) -> Vec<BinaryExpression<F>>[src]

pub fn add_most_significant(&mut self, bit: BooleanExpression<F>)[src]

pub fn join(&self) -> Expression<F>[src]

Join these bits into the field element they encode. This method requires that 2^self.len() < |F|, otherwise the result might not fit in a single field element.

pub fn join_allowing_overflow(&self) -> Expression<F>[src]

Join these bits into the field element they encode. This method allows binary expressions of any size, so overflow is possible.

pub fn dependencies(&self) -> Vec<Wire>[src]

pub fn evaluate(&self, values: &WireValues<F>) -> BigUint[src]

pub fn concat(expressions: &[BinaryExpression<F>]) -> Self[src]

Trait Implementations

impl<'_, F: Field> From<&'_ BinaryWire> for BinaryExpression<F>[src]

impl<F: Field> From<BinaryWire> for BinaryExpression<F>[src]

impl<F: Field> From<BigUint> for BinaryExpression<F>[src]

impl<F: Field> From<usize> for BinaryExpression<F>[src]

impl<F: Field> From<u128> for BinaryExpression<F>[src]

impl<F: Field> From<u64> for BinaryExpression<F>[src]

impl<F: Field> From<u32> for BinaryExpression<F>[src]

impl<F: Field> From<u16> for BinaryExpression<F>[src]

impl<F: Field> From<u8> for BinaryExpression<F>[src]

impl<F: Field> Clone for BinaryExpression<F>[src]

impl<F: Debug + Field> Debug for BinaryExpression<F>[src]

Auto Trait Implementations

impl<F> !Send for BinaryExpression<F>

impl<F> !Sync for BinaryExpression<F>

impl<F> Unpin for BinaryExpression<F>

impl<F> UnwindSafe for BinaryExpression<F> where
    F: RefUnwindSafe

impl<F> RefUnwindSafe for BinaryExpression<F> where
    F: RefUnwindSafe

Blanket Implementations

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

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

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<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]