Skip to main content

snarkvm_console_network_environment/
lib.rs

1// Copyright (c) 2019-2026 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        UniformExt,
78        cfg_chunks,
79        cfg_chunks_mut,
80        cfg_find,
81        cfg_find_map,
82        cfg_into_iter,
83        cfg_iter,
84        cfg_iter_mut,
85        cfg_keys,
86        cfg_par_bridge,
87        cfg_reduce,
88        cfg_reduce_with,
89        cfg_sort_by_cached_key,
90        cfg_sort_unstable_by,
91        cfg_sorted_by,
92        cfg_values,
93        cfg_zip_fold,
94        error,
95        has_duplicates,
96        into_io_error,
97        io_error,
98    };
99
100    pub use std::io::{Read, Result as IoResult, Write};
101
102    pub use core::{
103        cmp::Ordering,
104        fmt::{self, Debug, Display, Formatter},
105        hash::Hash as _,
106        iter::{Product, Sum},
107        ops::{
108            Add,
109            AddAssign,
110            BitAnd,
111            BitAndAssign,
112            BitOr,
113            BitOrAssign,
114            BitXor,
115            BitXorAssign,
116            Deref,
117            DerefMut,
118            Div,
119            DivAssign,
120            Mul,
121            MulAssign,
122            Neg,
123            Not,
124            Rem,
125            RemAssign,
126            Shl,
127            ShlAssign,
128            Shr,
129            ShrAssign,
130            Sub,
131            SubAssign,
132        },
133        str::{self, FromStr},
134    };
135
136    pub use anyhow::{Error, Result, anyhow, bail, ensure};
137    pub use bech32;
138    pub use itertools::Itertools;
139    pub use nom::{
140        Err,
141        branch::alt,
142        bytes::{complete::tag, streaming::take},
143        character::complete::{alpha1, alphanumeric1, char, one_of},
144        combinator::{complete, fail, map, map_res, opt, recognize},
145        error::{ErrorKind, make_error},
146        multi::{count, many_m_n, many0, many0_count, many1, separated_list0, separated_list1},
147        sequence::{delimited, pair, terminated},
148    };
149    pub use num_traits::{AsPrimitive, One, Pow, Zero};
150    pub use rand::{
151        CryptoRng,
152        RngExt as Rng,
153        distr::{Alphanumeric, Distribution, StandardUniform},
154    };
155    pub use serde::{
156        Deserialize,
157        Deserializer,
158        Serialize,
159        Serializer,
160        de,
161        de::{DeserializeOwned, EnumAccess, MapAccess, SeqAccess, VariantAccess, Visitor},
162        ser::{self, SerializeSeq, SerializeStruct},
163    };
164}