snark_verifier/loader/
halo2.rs

1//! `Loader` implementation for generating verifier in [`halo2_proofs`](crate::halo2_proofs) circuit.
2
3pub(crate) mod loader;
4mod shim;
5
6pub use loader::{EcPoint, Halo2Loader, Scalar};
7pub use shim::{EccInstructions, IntegerInstructions};
8pub use util::Valuetools;
9
10pub use halo2_ecc;
11
12mod util {
13    use crate::halo2_proofs::circuit::Value;
14
15    /// Helper methods when dealing with iterator of [`Value`].
16    pub trait Valuetools<V>: Iterator<Item = Value<V>> {
17        /// Fold zipped values into accumulator, returns `Value::unknown()` if
18        /// any is `Value::unknown()`.
19        fn fold_zipped<B, F>(self, init: B, mut f: F) -> Value<B>
20        where
21            Self: Sized,
22            F: FnMut(B, V) -> B,
23        {
24            self.fold(Value::known(init), |acc, value| {
25                acc.zip(value).map(|(acc, value)| f(acc, value))
26            })
27        }
28    }
29
30    impl<V, I: Iterator<Item = Value<V>>> Valuetools<V> for I {}
31}