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        io::{Read, Result as IoResult, Write},
93    };
94
95    pub use core::{
96        cmp::Ordering,
97        fmt::{self, Debug, Display, Formatter},
98        hash::Hash as _,
99        iter::{Product, Sum},
100        ops::{
101            Add,
102            AddAssign,
103            BitAnd,
104            BitAndAssign,
105            BitOr,
106            BitOrAssign,
107            BitXor,
108            BitXorAssign,
109            Deref,
110            DerefMut,
111            Div,
112            DivAssign,
113            Mul,
114            MulAssign,
115            Neg,
116            Not,
117            Rem,
118            RemAssign,
119            Shl,
120            ShlAssign,
121            Shr,
122            ShrAssign,
123            Sub,
124            SubAssign,
125        },
126        str::{self, FromStr},
127    };
128
129    pub use anyhow::{Error, Result, anyhow, bail, ensure};
130    pub use bech32::{self, FromBase32, ToBase32};
131    pub use itertools::Itertools;
132    pub use nom::{
133        Err,
134        branch::alt,
135        bytes::{complete::tag, streaming::take},
136        character::complete::{alpha1, alphanumeric1, char, one_of},
137        combinator::{complete, fail, map, map_res, opt, recognize},
138        error::{ErrorKind, make_error},
139        multi::{count, many0, many0_count, many1, separated_list0, separated_list1},
140        sequence::{pair, terminated},
141    };
142    pub use num_traits::{AsPrimitive, One, Pow, Zero};
143    pub use rand::{
144        CryptoRng,
145        Rng,
146        distributions::{Alphanumeric, Distribution, Standard},
147    };
148    pub use serde::{
149        Deserialize,
150        Deserializer,
151        Serialize,
152        Serializer,
153        de,
154        de::{DeserializeOwned, EnumAccess, MapAccess, SeqAccess, VariantAccess, Visitor},
155        ser::{self, SerializeSeq, SerializeStruct},
156    };
157}