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            ToBitsRaw,
35            algorithms::*,
36            arithmetic::*,
37            bitwise::*,
38            from_bits::*,
39            from_field::*,
40            parse::*,
41            parse_string::*,
42            to_bits_le,
43            to_field::*,
44            type_name::*,
45            types::{
46                integer_magnitude::Magnitude,
47                integer_type::{
48                    CheckedPow,
49                    CheckedShl,
50                    IntegerProperties,
51                    IntegerType,
52                    WrappingDiv,
53                    WrappingPow,
54                    WrappingRem,
55                },
56                *,
57            },
58            visibility::*,
59        },
60    };
61
62    pub use snarkvm_curves::{AffineCurve, MontgomeryParameters, ProjectiveCurve, TwistedEdwardsParameters};
63    pub use snarkvm_fields::{Field as _, PrimeField as _, SquareRootField as _, Zero as _};
64    pub use snarkvm_utilities::{
65        DeserializeExt,
66        FromBits as _,
67        FromBytes,
68        FromBytesDeserializer,
69        FromBytesUncheckedDeserializer,
70        LimitedWriter,
71        TestRng,
72        ToBits as _,
73        ToBitsRaw as _,
74        ToBytes,
75        ToBytesSerializer,
76        Uniform,
77        cfg_chunks,
78        cfg_chunks_mut,
79        cfg_find,
80        cfg_find_map,
81        cfg_into_iter,
82        cfg_iter,
83        cfg_iter_mut,
84        cfg_keys,
85        cfg_par_bridge,
86        cfg_reduce,
87        cfg_reduce_with,
88        cfg_sort_by_cached_key,
89        cfg_sort_unstable_by,
90        cfg_sorted_by,
91        cfg_values,
92        cfg_zip_fold,
93        error,
94        has_duplicates,
95        into_io_error,
96        io_error,
97    };
98
99    pub use std::io::{Read, Result as IoResult, Write};
100
101    pub use core::{
102        cmp::Ordering,
103        fmt::{self, Debug, Display, Formatter},
104        hash::Hash as _,
105        iter::{Product, Sum},
106        ops::{
107            Add,
108            AddAssign,
109            BitAnd,
110            BitAndAssign,
111            BitOr,
112            BitOrAssign,
113            BitXor,
114            BitXorAssign,
115            Deref,
116            DerefMut,
117            Div,
118            DivAssign,
119            Mul,
120            MulAssign,
121            Neg,
122            Not,
123            Rem,
124            RemAssign,
125            Shl,
126            ShlAssign,
127            Shr,
128            ShrAssign,
129            Sub,
130            SubAssign,
131        },
132        str::{self, FromStr},
133    };
134
135    pub use anyhow::{Error, Result, anyhow, bail, ensure};
136    pub use bech32::{self, FromBase32, ToBase32};
137    pub use itertools::Itertools;
138    pub use nom::{
139        Err,
140        branch::alt,
141        bytes::{complete::tag, streaming::take},
142        character::complete::{alpha1, alphanumeric1, char, one_of},
143        combinator::{complete, fail, map, map_res, opt, recognize},
144        error::{ErrorKind, make_error},
145        multi::{count, many0, many0_count, many1, separated_list0, separated_list1},
146        sequence::{pair, terminated},
147    };
148    pub use num_traits::{AsPrimitive, One, Pow, Zero};
149    pub use rand::{
150        CryptoRng,
151        Rng,
152        distributions::{Alphanumeric, Distribution, Standard},
153    };
154    pub use serde::{
155        Deserialize,
156        Deserializer,
157        Serialize,
158        Serializer,
159        de,
160        de::{DeserializeOwned, EnumAccess, MapAccess, SeqAccess, VariantAccess, Visitor},
161        ser::{self, SerializeSeq, SerializeStruct},
162    };
163}