snarkvm_console_network_environment/
lib.rs

1// Copyright (c) 2019-2025 Provable Inc.
2// This file is part of the snarkVM library.
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at:
7
8// http://www.apache.org/licenses/LICENSE-2.0
9
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#![forbid(unsafe_code)]
17#![allow(clippy::too_many_arguments)]
18
19mod environment;
20pub use environment::*;
21
22mod helpers;
23pub use helpers::*;
24
25pub mod traits;
26pub use traits::*;
27
28pub mod prelude {
29    pub use crate::{
30        environment::*,
31        helpers::*,
32        traits::{
33            ToBits,
34            algorithms::*,
35            arithmetic::*,
36            bitwise::*,
37            from_bits::*,
38            from_field::*,
39            parse::*,
40            parse_string::*,
41            to_bits_le,
42            to_field::*,
43            type_name::*,
44            types::{
45                integer_magnitude::Magnitude,
46                integer_type::{
47                    CheckedPow,
48                    CheckedShl,
49                    IntegerProperties,
50                    IntegerType,
51                    WrappingDiv,
52                    WrappingPow,
53                    WrappingRem,
54                },
55                *,
56            },
57            visibility::*,
58        },
59    };
60
61    pub use snarkvm_curves::{AffineCurve, MontgomeryParameters, ProjectiveCurve, TwistedEdwardsParameters};
62    pub use snarkvm_fields::{Field as _, PrimeField as _, SquareRootField as _, Zero as _};
63    pub use snarkvm_utilities::{
64        DeserializeExt,
65        FromBits as _,
66        FromBytes,
67        FromBytesDeserializer,
68        LimitedWriter,
69        TestRng,
70        ToBits as _,
71        ToBytes,
72        ToBytesSerializer,
73        Uniform,
74        cfg_chunks,
75        cfg_chunks_mut,
76        cfg_find,
77        cfg_find_map,
78        cfg_into_iter,
79        cfg_iter,
80        cfg_iter_mut,
81        cfg_keys,
82        cfg_par_bridge,
83        cfg_reduce,
84        cfg_reduce_with,
85        cfg_sort_by_cached_key,
86        cfg_sort_unstable_by,
87        cfg_sorted_by,
88        cfg_values,
89        cfg_zip_fold,
90        error,
91        has_duplicates,
92    };
93
94    pub use std::io::{Read, Result as IoResult, Write};
95
96    pub use core::{
97        cmp::Ordering,
98        fmt::{self, Debug, Display, Formatter},
99        hash::Hash as _,
100        iter::{Product, Sum},
101        ops::{
102            Add,
103            AddAssign,
104            BitAnd,
105            BitAndAssign,
106            BitOr,
107            BitOrAssign,
108            BitXor,
109            BitXorAssign,
110            Deref,
111            DerefMut,
112            Div,
113            DivAssign,
114            Mul,
115            MulAssign,
116            Neg,
117            Not,
118            Rem,
119            RemAssign,
120            Shl,
121            ShlAssign,
122            Shr,
123            ShrAssign,
124            Sub,
125            SubAssign,
126        },
127        str::{self, FromStr},
128    };
129
130    pub use anyhow::{Error, Result, anyhow, bail, ensure};
131    pub use bech32::{self, FromBase32, ToBase32};
132    pub use itertools::Itertools;
133    pub use nom::{
134        Err,
135        branch::alt,
136        bytes::{complete::tag, streaming::take},
137        character::complete::{alpha1, alphanumeric1, char, one_of},
138        combinator::{complete, fail, map, map_res, opt, recognize},
139        error::{ErrorKind, make_error},
140        multi::{count, many0, many0_count, many1, separated_list0, separated_list1},
141        sequence::{pair, terminated},
142    };
143    pub use num_traits::{AsPrimitive, One, Pow, Zero};
144    pub use rand::{
145        CryptoRng,
146        Rng,
147        distributions::{Alphanumeric, Distribution, Standard},
148    };
149    pub use serde::{
150        Deserialize,
151        Deserializer,
152        Serialize,
153        Serializer,
154        de,
155        de::{DeserializeOwned, EnumAccess, MapAccess, SeqAccess, VariantAccess, Visitor},
156        ser::{self, SerializeSeq, SerializeStruct},
157    };
158}