Module prelude

Source

Re-exports§

pub use crate::traits::types::integer_magnitude::Magnitude;
pub use crate::traits::types::integer_type::CheckedPow;
pub use crate::traits::types::integer_type::CheckedShl;
pub use crate::traits::types::integer_type::IntegerProperties;
pub use crate::traits::types::integer_type::IntegerType;
pub use crate::traits::types::integer_type::WrappingDiv;
pub use crate::traits::types::integer_type::WrappingPow;
pub use crate::traits::types::integer_type::WrappingRem;
pub use snarkvm_fields::Field as _;
pub use snarkvm_fields::PrimeField as _;
pub use snarkvm_fields::SquareRootField as _;
pub use snarkvm_fields::Zero as _;
pub use snarkvm_utilities::FromBits as _;
pub use snarkvm_utilities::ToBits as _;
pub use core::hash::Hash as _;
pub use core::hash::Hash as _;
pub use bech32;
pub use crate::traits::algorithms::*;
pub use crate::traits::arithmetic::*;
pub use crate::traits::bitwise::*;
pub use crate::traits::from_bits::*;
pub use crate::traits::from_field::*;
pub use crate::traits::parse::*;
pub use crate::traits::parse_string::*;
pub use crate::traits::to_field::*;
pub use crate::traits::type_name::*;
pub use crate::traits::types::*;
pub use crate::traits::visibility::*;

Modules§

de
Generic data structure deserialization framework.
error
fmt
Utilities for formatting and printing strings.
ser
Generic data structure serialization framework.
str
String manipulation.
variable_length

Macros§

anyhow
Construct an ad-hoc error from a string or existing non-anyhow error value.
bail
Return early with an error.
cfg_chunks
Returns an iterator over chunk_size elements of the slice at a time.
cfg_find
Finds the first element that satisfies the predicate function
cfg_find_map
Applies a function and returns the first value that is not None
cfg_into_iter
Creates parallel iterator if parallel feature is enabled.
cfg_iter
Creates parallel iterator over refs if parallel feature is enabled.
cfg_iter_mut
Creates parallel iterator over mut refs if parallel feature is enabled.
cfg_keys
Turns a collection into an iterator.
cfg_reduce
Applies the reduce operation over an iterator.
cfg_values
Turns a collection into an iterator.
ensure
Return early with an error if a condition is not satisfied.
to_bits_le
Takes as input a sequence of objects, and converts them to a series of little-endian bits. All traits that implement ToBits can be automatically converted to bits in this manner.

Structs§

Alphanumeric
Sample a u8, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9.
Console
Error
The Error type, a wrapper around a dynamic error type.
Formatter
Configuration for formatting.
FromBytesDeserializer
LimitedWriter
A wrapper around a Write instance that limits the number of bytes that can be written.
Sanitizer
Standard
A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type.
TestRng
A fast RNG used solely for testing and benchmarking, not for any real world purposes.
ToBytesSerializer

Enums§

Err
The Err enum indicates the parser was not successful
ErrorKind
Indicates which parser returned an error
Ordering
An Ordering is the result of a comparison between two values.

Traits§

Add
The addition operator +.
AddAssign
The addition assignment operator +=.
AffineCurve
Affine representation of an elliptic curve point guaranteed to be in the correct prime order subgroup.
AsPrimitive
A generic interface for casting between machine scalars with the as operator, which admits narrowing and precision loss. Implementers of this trait AsPrimitive should behave like a primitive numeric type (e.g. a newtype around another primitive), and the intended conversion must never fail.
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 ^=.
CryptoRng
A marker trait used to indicate that an RngCore or BlockRngCore implementation is supposed to be cryptographically secure.
Debug
? formatting.
Deref
Used for immutable dereferencing operations, like *v.
DerefMut
Used for mutable dereferencing operations, like in *v = 1;.
Deserialize
A data structure that can be deserialized from any data format supported by Serde.
DeserializeExt
A helper trait used to simplify value extraction.
DeserializeOwned
A data structure that can be deserialized without borrowing any data from the deserializer.
Deserializer
A data format that can deserialize any data structure supported by Serde.
Display
Format trait for an empty format, {}.
Distribution
Types (distributions) that can be used to create a random instance of T.
Div
The division operator /.
DivAssign
The division assignment operator /=.
EnumAccess
Provides a Visitor access to the data of an enum in the input.
Environment
FromBase32
Parse/convert base32 slice to Self. It is the reciprocal of ToBase32.
FromBytes
FromStr
Parse a value from a string
Itertools
An Iterator blanket implementation that provides extra adaptors and methods.
MapAccess
Provides a Visitor access to each entry of a map in the input.
MontgomeryParameters
Mul
The multiplication operator *.
MulAssign
The multiplication assignment operator *=.
Neg
The unary negation operator -.
Not
The unary logical negation operator !.
One
Defines a multiplicative identity element for Self.
OrHalt
A trait to unwrap a Result or Halt.
Pow
Binary operator for raising a value to a power.
Product
Trait to represent types that can be created by multiplying elements of an iterator.
ProjectiveCurve
Projective representation of an elliptic curve point guaranteed to be in the prime order subgroup.
Read
The Read trait allows for reading bytes from a source.
Rem
The remainder operator %.
RemAssign
The remainder assignment operator %=.
Rng
An automatically-implemented extension trait on RngCore providing high-level generic methods for sampling values and other convenience methods.
SeqAccess
Provides a Visitor access to each element of a sequence in the input.
Serialize
A data structure that can be serialized into any data format supported by Serde.
SerializeSeq
Returned from Serializer::serialize_seq.
SerializeStruct
Returned from Serializer::serialize_struct.
Serializer
A data format that can serialize any data structure supported by Serde.
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 <<=.
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 >>=.
Sub
The subtraction operator -.
SubAssign
The subtraction assignment operator -=.
Sum
Trait to represent types that can be created by summing up an iterator.
ToBase32
A trait for converting a value to a type T that represents a u5 slice.
ToBits
ToBytes
TwistedEdwardsParameters
Uniform
A trait for a uniform random number generator.
VariantAccess
VariantAccess is a visitor that is created by the Deserializer and passed to the Deserialize to deserialize the content of a particular enum variant.
Visitor
This trait represents a visitor that walks through a deserializer.
Write
A trait for objects which are byte-oriented sinks.
Zero
Defines an additive 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.
complete
Transforms Incomplete into Error.
count
Runs the embedded parser count times, gathering the results in a Vec
error
fail
A parser which always fails.
has_duplicates
Returns true if the given iterator has duplicate elements.
make_error
Creates an error from the input position and an ErrorKind
many0
Repeats the embedded parser, gathering the results in a Vec.
many0_count
Repeats the embedded parser, counting the results
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.
read_variable_length_integer
Decode the value of a variable length integer. https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer
recognize
If the child parser was successful, return the consumed input as produced value.
separated_list0
Alternates between two parsers to produce a list of elements.
separated_list1
Alternates between two parsers to produce a list of elements until Err::Error.
tag
Recognizes a pattern
take
Returns an input slice containing the first N input elements (Input[..N]).
terminated
Gets an object from the first parser, then matches an object from the second parser and discards it.
variable_length_integer
Returns the variable length integer of the given value. https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer

Type Aliases§

IoResult
A specialized Result type for I/O operations.
Result
Result<T, Error>

Derive Macros§

Debug
Derive macro generating an impl of the trait Debug.
Deserialize
Serialize