lib.rs
1 // Copyright (c) 2025 ADnet Contributors 2 // This file is part of the AlphaVM 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 19 mod environment; 20 pub use environment::*; 21 22 mod helpers; 23 pub use helpers::*; 24 25 pub mod traits; 26 pub use traits::*; 27 28 pub mod prelude { 29 pub use crate::{ 30 environment::*, 31 helpers::*, 32 traits::{ 33 ToBits, ToBitsRaw, 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, CheckedShl, IntegerProperties, IntegerType, WrappingDiv, WrappingPow, WrappingRem, 48 }, 49 *, 50 }, 51 visibility::*, 52 }, 53 }; 54 55 pub use alphavm_curves::{AffineCurve, MontgomeryParameters, ProjectiveCurve, TwistedEdwardsParameters}; 56 pub use alphavm_fields::{Field as _, PrimeField as _, SquareRootField as _, Zero as _}; 57 pub use alphavm_utilities::{ 58 DeserializeExt, FromBits as _, FromBytes, FromBytesDeserializer, FromBytesUncheckedDeserializer, LimitedWriter, 59 TestRng, ToBits as _, ToBitsRaw as _, ToBytes, ToBytesSerializer, Uniform, cfg_chunks, cfg_chunks_mut, 60 cfg_find, cfg_find_map, cfg_into_iter, cfg_iter, cfg_iter_mut, cfg_keys, cfg_par_bridge, cfg_reduce, 61 cfg_reduce_with, cfg_sort_by_cached_key, cfg_sort_unstable_by, cfg_sorted_by, cfg_values, cfg_zip_fold, error, 62 has_duplicates, into_io_error, io_error, 63 }; 64 65 pub use std::io::{Read, Result as IoResult, Write}; 66 67 pub use core::{ 68 cmp::Ordering, 69 fmt::{self, Debug, Display, Formatter}, 70 hash::Hash as _, 71 iter::{Product, Sum}, 72 ops::{ 73 Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Deref, DerefMut, Div, 74 DivAssign, Mul, MulAssign, Neg, Not, Rem, RemAssign, Shl, ShlAssign, Shr, ShrAssign, Sub, SubAssign, 75 }, 76 str::{self, FromStr}, 77 }; 78 79 pub use anyhow::{Error, Result, anyhow, bail, ensure}; 80 pub use bech32::{self, FromBase32, ToBase32}; 81 pub use itertools::Itertools; 82 pub use nom::{ 83 Err, 84 branch::alt, 85 bytes::{complete::tag, streaming::take}, 86 character::complete::{alpha1, alphanumeric1, char, one_of}, 87 combinator::{complete, fail, map, map_res, opt, recognize}, 88 error::{ErrorKind, make_error}, 89 multi::{count, many0, many0_count, many1, separated_list0, separated_list1}, 90 sequence::{pair, terminated}, 91 }; 92 pub use num_traits::{AsPrimitive, One, Pow, Zero}; 93 pub use rand::{ 94 CryptoRng, Rng, 95 distributions::{Alphanumeric, Distribution, Standard}, 96 }; 97 pub use serde::{ 98 Deserialize, Deserializer, Serialize, Serializer, de, 99 de::{DeserializeOwned, EnumAccess, MapAccess, SeqAccess, VariantAccess, Visitor}, 100 ser::{self, SerializeSeq, SerializeStruct}, 101 }; 102 }