[][src]Struct zkinterface::structs::constraints::ConstraintSystem

pub struct ConstraintSystem {
    pub constraints: Vec<BilinearConstraint>,
}

Fields

constraints: Vec<BilinearConstraint>

Implementations

impl ConstraintSystem[src]

pub fn build<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
    &'args self,
    builder: &'mut_bldr mut FlatBufferBuilder<'bldr>
) -> WIPOffset<Root<'bldr>>
[src]

Add this structure into a Flatbuffers message builder.

pub fn write_into(&self, writer: &mut impl Write) -> Result<()>[src]

Writes this constraint system as a Flatbuffers message into the provided buffer.

Examples

let mut buf = Vec::<u8>::new();
let constraints = zkinterface::ConstraintSystem::from(&[][..]);
constraints.write_into(&mut buf).unwrap();
assert!(buf.len() > 0);

Trait Implementations

impl Clone for ConstraintSystem[src]

impl Debug for ConstraintSystem[src]

impl Default for ConstraintSystem[src]

impl<'de> Deserialize<'de> for ConstraintSystem[src]

impl Eq for ConstraintSystem[src]

impl<'_> From<&'_ [((Vec<u64>, Vec<u8>), (Vec<u64>, Vec<u8>), (Vec<u64>, Vec<u8>))]> for ConstraintSystem[src]

fn from(
    constraints_vec: &[((Vec<u64>, Vec<u8>), (Vec<u64>, Vec<u8>), (Vec<u64>, Vec<u8>))]
) -> ConstraintSystem
[src]

Creates a ConstraintSystem from an R1CS vector

Examples

let constraints_vec: &[((Vec<u64>, Vec<u8>), (Vec<u64>, Vec<u8>), (Vec<u64>, Vec<u8>))] = &[
    // (A ids values)  *  (B ids values)  =  (C ids values)
    ((vec![1], vec![1]), (vec![1], vec![1]), (vec![4], vec![1])),       // x * x = xx
    ((vec![2], vec![1]), (vec![2], vec![1]), (vec![5], vec![1])),       // y * y = yy
    ((vec![0], vec![1]), (vec![4, 5], vec![1, 1]), (vec![3], vec![1])), // 1 * (xx + yy) = z
];

let constraints = zkinterface::ConstraintSystem::from(constraints_vec);

impl<'a> From<ConstraintSystem<'a>> for ConstraintSystem[src]

fn from(fb_cs: ConstraintSystem<'_>) -> ConstraintSystem[src]

Convert from Flatbuffers references to owned structure.

impl PartialEq<ConstraintSystem> for ConstraintSystem[src]

impl Serialize for ConstraintSystem[src]

impl StructuralEq for ConstraintSystem[src]

impl StructuralPartialEq for ConstraintSystem[src]

impl<'a> TryFrom<&'a [u8]> for ConstraintSystem[src]

type Error = Box<dyn Error>

The type returned in the event of a conversion error.

Auto Trait Implementations

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<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

impl<T, U> Into<U> for T where
    U: From<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.