Module snarkvm_circuit::prelude::prelude
source · Modules
Utilities for formatting and printing strings.
From https://github.com/Geal/nom/blob/main/examples/string.rs
This example shows an example of how to parse an escaped string. The
rules for the string are similar to JSON and rust. A string is:
Macros
Derive macro generating an impl of the trait
Debug
.Return early with an error.
The
witness!
macro is a closure that takes in a list of circuits,
eject the value of each circuit, and uses it in the subsequent code block.The
witness_mode!
macro returns the expected mode given a list of circuits.Structs
A helper struct for tracking the number of constants, public inputs, private inputs, and constraints.
The
Error
type, a wrapper around a dynamic error type.Configuration for formatting.
A hash table where the iteration order of the key-value pairs is independent
of the hash values of the keys.
A cell which can be written to only once. It is not thread safe.
Enums
Helper enum used in the case where a circuit’s output mode or counts are determined by
its mode and the actual value of the circuit.
Traits
Unary operator for retrieving the absolute value, enforcing an overflow never occurs.
Unary operator for retrieving the absolute value, bounding the difference to
MAX
if an overflow occurs.Unary operator for retrieving the absolute value, wrapping the result if an overflow occurs.
The addition operator
+
.The addition assignment operator
+=
.Binary operator for adding two values, enforcing an overflow never occurs.
Binary operator for adding two values, bounding the sum to
MAX
if an overflow occurs.Binary operator for adding two values, wrapping the sum if an overflow occurs.
A single-bit binary adder with a carry bit.
The bitwise AND operator
&
.The bitwise AND assignment operator
&=
.The bitwise OR operator
|
.The bitwise OR assignment operator
|=
.The bitwise XOR operator
^
.The bitwise XOR assignment operator
^=
.Representation of a boolean.
Trait for comparator operations.
?
formatting.Used for immutable dereferencing operations, like
*v
.Format trait for an empty format,
{}
.The division operator
/
.The division assignment operator
/=
.Binary operator for dividing two values, enforcing an overflow never occurs.
Binary operator for dividing two values, bounding the quotient to
MAX
or MIN
if an overflow occurs.Binary operator for dividing two values, without checking specific conditions.
Binary operator for dividing two values, wrapping the quotient if an overflow occurs.
Unary operator for retrieving the doubled value.
Operations to eject from a circuit environment into primitive form.
Trait for equality comparisons.
Representation of a base field element.
Unary operator for instantiating from bits.
Unary operator for instantiating from a boolean.
Unary operator for converting from a base field element.
Unary operator for converting from a list of base elements.
Unary operator for converting from an affine group element.
Parse a value from a string
Representation of a group element.
Operations to inject from a primitive form into a circuit environment.
Properties common to all integer types.
Representation of an integer.
Trait bound for integer values. Common to both signed and unsigned integers.
Unary operator for retrieving the multiplicative inverse, or reciprocal, of a value.
Unary operator for retrieving the inverse value.
Unary operator for retrieving the most-significant bit.
Trait for integers that can be used as an unsigned magnitude.
Magnitude
s are either used to represent an integer exponent
or the right operand in integer shift operations.Trait for determining the number of constants, public input, private inputs, and constraints for an operation.
Binary operator for modding two values.
The multiplication operator
*
.The multiplication assignment operator
*=
.Binary operator for multiplying two values, enforcing an overflow never occurs.
Binary operator for multiplying two values, bounding the product to
MAX
if an overflow occurs.Binary operator for multiplying two values, wrapping the product if an overflow occurs.
Binary operator for performing
NOT (a AND b)
.The unary negation operator
-
.Binary operator for performing
(NOT a) AND (NOT b)
.The unary logical negation operator
!
.Defines a multiplicative identity element for
Self
.Representation of the one value.
Trait for determining the mode of the output of an operation.
Operations to parse a string literal into an object.
Binary operator for raising a value to a power.
Binary operator for exponentiating two values, enforcing an overflow never occurs.
Binary operator for exponentiating two values, wrapping the result if an overflow occurs.
The interface for a prime field.
The remainder operator
%
.The remainder assignment operator
%=
.Binary operator for dividing two values and returning the remainder, enforcing an overflow never occurs.
Binary operator for dividing two values, bounding the remainder to
MAX
or MIN
if an overflow occurs.Binary operator for dividing two values, wrapping the remainder if an overflow occurs.
Representation of a scalar field element.
The left shift operator
<<
. Note that because this trait is implemented
for all integer types with multiple right-hand-side types, Rust’s type
checker has special handling for _ << _
, setting the result type for
integer operations to the type of the left-hand-side operand. This means
that though a << b
and a.shl(b)
are one and the same from an evaluation
standpoint, they are different when it comes to type inference.The left shift assignment operator
<<=
.Binary operator for left shifting a value, checking that the rhs is less than the number
of bits in self.
Binary operator for left shifting a value, safely continuing past the number of bits in self.
The right shift operator
>>
. Note that because this trait is implemented
for all integer types with multiple right-hand-side types, Rust’s type
checker has special handling for _ >> _
, setting the result type for
integer operations to the type of the left-hand-side operand. This means
that though a >> b
and a.shr(b)
are one and the same from an evaluation
standpoint, they are different when it comes to type inference.The right shift assignment operator
>>=
.Binary operator for right shifting a value, checking that the rhs is less than the number
of bits in self.
Binary operator for right shifting a value, safely continuing past the number of bits in self.
Unary operator for retrieving the squared value.
Unary operator for retrieving the square root of the value.
The subtraction operator
-
.The subtraction assignment operator
-=
.Binary operator for subtracting two values, enforcing an underflow never occurs.
Binary operator for subtracting two values, bounding the difference to
MIN
if an underflow occurs.Binary operator for subtracting two values, wrapping the difference if an underflow occurs.
A single-bit binary subtractor with a borrow bit.
Trait for ternary operations.
Unary operator for converting to bits.
Unary operator for converting to a base field.
Unary operator for converting to a list of base fields.
Unary operator for converting to an affine group.
Unary operator for converting to
k
number of bits.Unary operator for converting to
k
number of bits.A trait for values which cannot be negative
Representation of the zero value.
Defines a multiplicative identity element for
Self
.Defines an additive identity element for
Self
.Unary operator for retrieving the doubled value.
Unary operator for retrieving the inverse value.
Unary operator for retrieving the squared value.
Unary operator for retrieving the square root of the value.
The interface for a generic field.
Affine representation of an elliptic curve point guaranteed to be
in the correct prime order subgroup.
Functions
Recognizes one or more lowercase and uppercase ASCII alphabetic characters: a-z, A-Z
Recognizes one or more ASCII numerical and alphabetic characters: 0-9, a-z, A-Z
Tests a list of parsers one by one until one succeeds.
Recognizes one character.
Returns true if the given iterator has duplicate elements.
Repeats the embedded parser until it fails
and returns the results in a
Vec
.Runs the embedded parser until it fails and
returns the results in a
Vec
. Fails if
the embedded parser does not produce at least
one result.Maps a function on the result of a parser.
Applies a function returning a
Result
over the result of a parser.Recognizes one of the provided characters.
Optional parser: Will return
None
if not successful.Gets an object from the first parser,
then gets another object from the second parser.
If the child parser was successful, return the consumed input as produced value.
Recognizes a pattern
Gets an object from the first parser,
then matches an object from the second parser and discards it.
Type Definitions
The
nom
-compatible parser return type.Result<T, Error>