[][src]Struct r1cs::Expression

pub struct Expression<F: Field> { /* fields omitted */ }

A linear combination of wires.

Methods

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

pub fn new(coefficients: BTreeMap<Wire, Element<F>>) -> Self[src]

Creates a new expression with the given wire coefficients.

pub fn coefficients(&self) -> &BTreeMap<Wire, Element<F>>[src]

pub fn sum_of_wires(wires: &[Wire]) -> Self[src]

The sum of zero or more wires, each with an implied coefficient of 1.

pub fn sum_of_expressions(expressions: &[Expression<F>]) -> Self[src]

The collectivization of all existing Expression’s Wires with each destination Wire’s coefficient the sum of each source’s coefficients.

pub fn zero() -> Self[src]

pub fn one() -> Self[src]

pub fn neg_one() -> Self[src]

The additive inverse of 1.

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

pub fn as_constant(&self) -> Option<Element<F>>[src]

Return Some(c) if this is a constant c, otherwise None.

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

Return a vector of all wires that this expression depends on.

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

Trait Implementations

impl<F: Field> From<Wire> for Expression<F>[src]

impl<'_, F: Field> From<&'_ Wire> for Expression<F>[src]

impl<F: Field> From<Element<F>> for Expression<F>[src]

impl<'_, F: Field> From<&'_ Element<F>> for Expression<F>[src]

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

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

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

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

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

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

impl<F: Field> From<bool> for Expression<F>[src]

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

impl<F: Eq + Field> Eq for Expression<F>[src]

impl<F: PartialEq + Field> PartialEq<Expression<F>> for Expression<F>[src]

impl<F: Field> Display for Expression<F>[src]

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

impl<F: Field> Div<Element<F>> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the / operator.

impl<'_, F: Field> Div<&'_ Element<F>> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the / operator.

impl<'_, F: Field> Div<Element<F>> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the / operator.

impl<'_, '_, F: Field> Div<&'_ Element<F>> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the / operator.

impl<F: Field> Div<u128> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the / operator.

impl<'_, F: Field> Div<u128> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the / operator.

impl<F: Field> Sub<Expression<F>> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the - operator.

impl<'_, F: Field> Sub<&'_ Expression<F>> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the - operator.

impl<'_, F: Field> Sub<Expression<F>> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the - operator.

impl<'_, '_, F: Field> Sub<&'_ Expression<F>> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the - operator.

impl<F: Field> Add<Expression<F>> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the + operator.

impl<'_, F: Field> Add<&'_ Expression<F>> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the + operator.

impl<'_, F: Field> Add<Expression<F>> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the + operator.

impl<'_, '_, F: Field> Add<&'_ Expression<F>> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the + operator.

impl<F: Field> Mul<Element<F>> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the * operator.

impl<'_, F: Field> Mul<&'_ Element<F>> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the * operator.

impl<'_, F: Field> Mul<Element<F>> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the * operator.

impl<'_, '_, F: Field> Mul<&'_ Element<F>> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the * operator.

impl<F: Field> Mul<u128> for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the * operator.

impl<'_, F: Field> Mul<u128> for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the * operator.

impl<'_, F: Field> Neg for &'_ Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the - operator.

impl<F: Field> Neg for Expression<F>[src]

type Output = Expression<F>

The resulting type after applying the - operator.

impl<F: Field> AddAssign<Expression<F>> for Expression<F>[src]

impl<'_, F: Field> AddAssign<&'_ Expression<F>> for Expression<F>[src]

impl<F: Field> SubAssign<Expression<F>> for Expression<F>[src]

impl<'_, F: Field> SubAssign<&'_ Expression<F>> for Expression<F>[src]

impl<F: Field> MulAssign<Element<F>> for Expression<F>[src]

impl<'_, F: Field> MulAssign<&'_ Element<F>> for Expression<F>[src]

impl<F: Field> MulAssign<u128> for Expression<F>[src]

impl<F: Field> DivAssign<Element<F>> for Expression<F>[src]

impl<'_, F: Field> DivAssign<&'_ Element<F>> for Expression<F>[src]

impl<F: Field> DivAssign<u128> for Expression<F>[src]

Auto Trait Implementations

impl<F> !Send for Expression<F>

impl<F> !Sync for Expression<F>

impl<F> Unpin for Expression<F>

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

impl<F> RefUnwindSafe for Expression<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> ToString for T where
    T: Display + ?Sized
[src]

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]