Module prelude

Source

Re-exports§

pub use crate::modules::*;

Modules§

count
fmt
Utilities for formatting and printing strings.
num_traits
Numeric traits for generic mathematics
snarkvm_fields
string_parser
From https://github.com/Geal/nom/blob/main/examples/string.rs

Macros§

bail
Return early with an error.
count
count_is
To update the arguments to count_is!, run cargo test with the UPDATE_COUNT flag set to the name of the file containing the macro invocation. e.g. `UPDATE_COUNT=boolean cargo test See https://github.com/ProvableHQ/snarkVM/pull/1688 for more details.
count_less_than
To update the arguments to count_less_than!, run cargo test with the UPDATE_COUNT flag set to the name of the file containing the macro invocation. e.g. `UPDATE_COUNT=boolean cargo test See https://github.com/ProvableHQ/snarkVM/pull/1688 for more details.
ensure
Return early with an error if a condition is not satisfied.
output_mode
rename_selfs
witness
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.
witness_mode
The witness_mode! macro returns the expected mode given a list of circuits.

Structs§

Count
A helper struct for tracking the number of constants, public inputs, private inputs, and constraints.
Error
The Error type, a wrapper around a dynamic error type.
Formatter
Configuration for formatting.
IndexMap
A hash table where the iteration order of the key-value pairs is independent of the hash values of the keys.
LinearCombination
OnceCell
A cell which can be written to only once. It is not thread safe.

Enums§

CircuitType
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.
Mode
Variable

Traits§

AbsChecked
Unary operator for retrieving the absolute value, enforcing an overflow never occurs.
AbsSaturating
Unary operator for retrieving the absolute value, bounding the difference to MAX if an overflow occurs.
AbsWrapped
Unary operator for retrieving the absolute value, wrapping the result if an overflow occurs.
Add
The addition operator +.
AddAssign
The addition assignment operator +=.
AddChecked
Binary operator for adding two values, enforcing an overflow never occurs.
AddSaturating
Binary operator for adding two values, bounding the sum to MAX if an overflow occurs.
AddWrapped
Binary operator for adding two values, wrapping the sum if an overflow occurs.
Adder
A single-bit binary adder with a carry bit.
AddressTrait
BitAnd
The bitwise AND operator &.
BitAndAssign
The bitwise AND assignment operator &=.
BitOr
The bitwise OR operator |.
BitOrAssign
The bitwise OR assignment operator |=.
BitXor
The bitwise XOR operator ^.
BitXorAssign
The bitwise XOR assignment operator ^=.
BooleanTrait
Representation of a boolean.
CheckedPow
Compare
Trait for comparator operations.
Debug
? formatting.
Deref
Used for immutable dereferencing operations, like *v.
Display
Format trait for an empty format, {}.
Div
The division operator /.
DivAssign
The division assignment operator /=.
DivChecked
Binary operator for dividing two values, enforcing an overflow never occurs.
DivSaturating
Binary operator for dividing two values, bounding the quotient to MAX or MIN if an overflow occurs.
DivUnchecked
Binary operator for dividing two values, without checking specific conditions.
DivWrapped
Binary operator for dividing two values, wrapping the quotient if an overflow occurs.
Double
Unary operator for retrieving the doubled value.
Eject
Operations to eject from a circuit environment into primitive form.
Environment
Attention: Do not use Send + Sync on this trait, as it is not thread-safe.
Equal
Trait for equality comparisons.
FieldTrait
Representation of a base field element.
FromBits
Unary operator for instantiating from bits.
FromBoolean
Unary operator for instantiating from a boolean.
FromField
Unary operator for converting from a base field element.
FromFields
Unary operator for converting from a list of base elements.
FromGroup
Unary operator for converting from an affine group element.
FromStr
Parse a value from a string
GroupTrait
Representation of a group element.
Inject
Operations to inject from a primitive form into a circuit environment.
IntegerCore
IntegerProperties
Properties common to all integer types.
IntegerTrait
Representation of an integer.
IntegerType
Trait bound for integer values. Common to both signed and unsigned integers.
Inv
Unary operator for retrieving the multiplicative inverse, or reciprocal, of a value.
Inverse
Unary operator for retrieving the inverse value.
Itertools
An Iterator blanket implementation that provides extra adaptors and methods.
MSB
Unary operator for retrieving the most-significant bit.
Magnitude
Trait for integers that can be used as an unsigned magnitude. Magnitudes are either used to represent an integer exponent or the right operand in integer shift operations.
Metrics
Trait for determining the number of constants, public input, private inputs, and constraints for an operation.
Modulo
Binary operator for modding two values.
Mul
The multiplication operator *.
MulAssign
The multiplication assignment operator *=.
MulChecked
Binary operator for multiplying two values, enforcing an overflow never occurs.
MulSaturating
Binary operator for multiplying two values, bounding the product to MAX if an overflow occurs.
MulWrapped
Binary operator for multiplying two values, wrapping the product if an overflow occurs.
Nand
Binary operator for performing NOT (a AND b).
Neg
The unary negation operator -.
Nor
Binary operator for performing (NOT a) AND (NOT b).
Not
The unary logical negation operator !.
NumOne
Defines a multiplicative identity element for Self.
One
Representation of the one value.
OutputMode
Trait for determining the mode of the output of an operation.
Parser
Operations to parse a string literal into an object.
Pow
Binary operator for raising a value to a power.
PowChecked
Binary operator for exponentiating two values, enforcing an overflow never occurs.
PowWrapped
Binary operator for exponentiating two values, wrapping the result if an overflow occurs.
PrimeField
The interface for a prime field.
Rem
The remainder operator %.
RemAssign
The remainder assignment operator %=.
RemChecked
Binary operator for dividing two values and returning the remainder, enforcing an overflow never occurs.
RemSaturating
Binary operator for dividing two values, bounding the remainder to MAX or MIN if an overflow occurs.
RemWrapped
Binary operator for dividing two values, wrapping the remainder if an overflow occurs.
ScalarTrait
Representation of a scalar field element.
Shl
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.
ShlAssign
The left shift assignment operator <<=.
ShlChecked
Binary operator for left shifting a value, checking that the rhs is less than the number of bits in self.
ShlWrapped
Binary operator for left shifting a value, safely continuing past the number of bits in self.
Shr
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.
ShrAssign
The right shift assignment operator >>=.
ShrChecked
Binary operator for right shifting a value, checking that the rhs is less than the number of bits in self.
ShrWrapped
Binary operator for right shifting a value, safely continuing past the number of bits in self.
SizeInBits
SizeInDataBits
Square
Unary operator for retrieving the squared value.
SquareRoot
Unary operator for retrieving the square root of the value.
StringTrait
Sub
The subtraction operator -.
SubAssign
The subtraction assignment operator -=.
SubChecked
Binary operator for subtracting two values, enforcing an underflow never occurs.
SubSaturating
Binary operator for subtracting two values, bounding the difference to MIN if an underflow occurs.
SubWrapped
Binary operator for subtracting two values, wrapping the difference if an underflow occurs.
Subtractor
A single-bit binary subtractor with a borrow bit.
Ternary
Trait for ternary operations.
ToBits
Unary operator for converting to bits.
ToField
Unary operator for converting to a base field.
ToFields
Unary operator for converting to a list of base fields.
ToGroup
Unary operator for converting to an affine group.
ToLowerBits
Unary operator for converting to k number of bits.
ToUpperBits
Unary operator for converting to k number of bits.
TypeName
Unsigned
A trait for values which cannot be negative
WrappingDiv
WrappingPow
WrappingRem
Zero
Representation of the zero value.
_
Defines a multiplicative identity element for Self.

Functions§

alpha1
Recognizes one or more lowercase and uppercase ASCII alphabetic characters: a-z, A-Z
alphanumeric1
Recognizes one or more ASCII numerical and alphabetic characters: 0-9, a-z, A-Z
alt
Tests a list of parsers one by one until one succeeds.
char
Recognizes one character.
has_duplicates
Returns true if the given iterator has duplicate elements.
many0
Repeats the embedded parser, gathering the results in a Vec.
many1
Runs the embedded parser, gathering the results in a Vec.
map
Maps a function on the result of a parser.
map_res
Applies a function returning a Result over the result of a parser.
one_of
Recognizes one of the provided characters.
opt
Optional parser, will return None on Err::Error.
pair
Gets an object from the first parser, then gets another object from the second parser.
recognize
If the child parser was successful, return the consumed input as produced value.
tag
Recognizes a pattern
terminated
Gets an object from the first parser, then matches an object from the second parser and discards it.

Type Aliases§

ParserResult
The nom-compatible parser return type.
Result
Result<T, Error>

Derive Macros§

Debug
Derive macro generating an impl of the trait Debug.