Struct ProgramNode

Source
pub struct ProgramNode<T>
where T: ZkpType,
{ pub ids: &'static [NodeIndex], /* private fields */ }
Expand description

An implementation detail of the ZKP compiler. Each expression in a ZKP program is expressed in terms of ProgramNode, which proxy and compose the parse graph for a ZKP program.

They proxy operations (+, -, /, etc) to their underlying type T to manipulate the program graph as appropriate.

§Remarks

For internal use only.

Fields§

§ids: &'static [NodeIndex]

The indices in the graph that compose the type backing this ProgramNode.

Implementations§

Source§

impl<T> ProgramNode<T>
where T: ZkpType,

Source

pub fn new(ids: &[NodeIndex]) -> Self

Create a new Program node from the given indicies in the

Trait Implementations§

Source§

impl<T> Add for ProgramNode<T>
where T: AddVar + ZkpType,

Source§

type Output = ProgramNode<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Clone for ProgramNode<T>
where T: ZkpType + Clone,

Source§

fn clone(&self) -> ProgramNode<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> CreateZkpProgramInput for ProgramNode<T>
where T: ZkpType,

Source§

fn public_input() -> Self

Creates a public program input of type T.
Source§

fn private_input() -> Self

Creates a private program input of type T.
Source§

fn constant_input() -> Self

Creates a constant program input of type T.
Source§

impl<T: ZkpType> Debug for ProgramNode<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Div for ProgramNode<T>
where T: DivVar + ZkpType,

Source§

type Output = ProgramNode<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> IntoProgramNode for ProgramNode<T>
where T: ZkpType,

Source§

type Output = T

The type of ProgramNode this becomes.
Source§

fn into_program_node(self) -> ProgramNode<Self::Output>

Turns the given value into a ProgramNode. Read more
Source§

impl<T> Mul for ProgramNode<T>
where T: MulVar + ZkpType,

Source§

type Output = ProgramNode<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Neg for ProgramNode<T>
where T: NegVar + ZkpType,

Source§

type Output = ProgramNode<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> Rem for ProgramNode<T>
where T: RemVar + ZkpType,

Source§

type Output = ProgramNode<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl<F: FieldSpec, const D: usize, const R: usize> Scale<F> for ProgramNode<RnsRingPolynomial<F, D, R>>

Source§

fn scale(self, x: ProgramNode<Field<F>>) -> Self

Return a structure scaled by x.
Source§

impl<T> Sub for ProgramNode<T>
where T: SubVar + ZkpType,

Source§

type Output = ProgramNode<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<F: FieldSpec> ToBinary<F> for ProgramNode<Field<F>>

Source§

fn to_unsigned<const N: usize>(&self) -> [ProgramNode<Field<F>>; N]

Decompose this value into unsigned N-bit binary. If the value is too large, the proof will fail to validate.
Source§

impl<F: FieldSpec, const N: usize, const R: usize> ToResidues<F, N, R> for ProgramNode<RnsRingPolynomial<F, N, R>>

Source§

fn residues(&self) -> [[ProgramNode<Field<F>>; N]; R]

Return the residues.
Source§

impl<T> Copy for ProgramNode<T>
where T: ZkpType + Copy,

Auto Trait Implementations§

§

impl<T> Freeze for ProgramNode<T>

§

impl<T> RefUnwindSafe for ProgramNode<T>
where T: RefUnwindSafe,

§

impl<T> Send for ProgramNode<T>
where T: Send,

§

impl<T> Sync for ProgramNode<T>
where T: Sync,

§

impl<T> Unpin for ProgramNode<T>
where T: Unpin,

§

impl<T> UnwindSafe for ProgramNode<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T, U, V> ConstrainCmp<T> for U
where U: IntoProgramNode<Output = V>, T: IntoProgramNode<Output = V>, V: ZkpType + ConstrainCmpVarVar,

Source§

fn constrain_le_bounded(self, rhs: T, bits: usize)

Constrain that this value is less than or equal to the RHS. Read more
Source§

fn constrain_lt_bounded(self, rhs: T, bits: usize)

Constrain that this value is less than the RHS. Read more
Source§

fn constrain_ge_bounded(self, rhs: T, bits: usize)

Constrain that this value is greater than or equal to the RHS. Read more
Source§

fn constrain_gt_bounded(self, rhs: T, bits: usize)

Constrain that this value is greater than the RHS. Read more
Source§

impl<T, U, V> ConstrainEq<T> for U
where U: IntoProgramNode<Output = V>, T: IntoProgramNode<Output = V>, V: ZkpType + ConstrainEqVarVar,

Source§

fn constrain_eq(self, rhs: T) -> ProgramNode<<U as ConstrainEq<T>>::Output>

Constrains this native field to equal the right hand side

Source§

type Output = V

The return value will be ProgramNode<Self::Output>
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T, U> ZkpInto<T> for U
where T: ZkpFrom<U>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,