use std::fmt::Debug;
use std::hash::Hash;
use ff::PrimeField;
use group::Group;
pub trait PairingEngine: Clone + Debug + Send + Sync + 'static {
type Fr: PrimeField + Hash;
type G1Affine: Clone
+ Debug
+ Send
+ Sync
+ PartialEq
+ Eq
+ Into<Self::G1>
+ group::GroupEncoding
+ group::prime::PrimeCurveAffine;
type G1: Group<Scalar = Self::Fr>
+ Clone
+ Debug
+ Send
+ Sync
+ group::Curve<AffineRepr = Self::G1Affine>;
type G2Affine: Clone + Debug + Send + Sync + PartialEq + Eq + group::GroupEncoding + group::prime::PrimeCurveAffine;
type Gt: Group + Clone + Debug + PartialEq + Eq;
fn pairing(p: &Self::G1Affine, q: &Self::G2Affine) -> Self::Gt;
fn multi_pairing<'a>(
pairs: impl IntoIterator<Item = (&'a Self::G1Affine, &'a Self::G2Affine)>,
) -> Self::Gt
where
Self::G1Affine: 'a,
Self::G2Affine: 'a;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn engine_is_object_safe_for_static_dispatch() {
fn _accepts_engine<E: PairingEngine>() {}
}
#[test]
fn associated_types_have_required_bounds() {
fn _check_fr_bounds<F: PrimeField + Hash>() {}
fn _check_group_bounds<G: Group + Clone + Debug + Send + Sync>() {}
}
}