group: Sum + for<'a> Sum<&'a Self> bounds for Group
This commit is contained in:
parent
78db26b713
commit
bca06de21c
|
@ -4,6 +4,7 @@ use pairing::{Engine, PairingCurveAffine};
|
|||
|
||||
use rand_core::RngCore;
|
||||
use std::fmt;
|
||||
use std::iter::Sum;
|
||||
use std::num::Wrapping;
|
||||
use std::ops::{Add, AddAssign, BitAnd, Mul, MulAssign, Neg, Shr, Sub, SubAssign};
|
||||
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
|
||||
|
@ -47,6 +48,18 @@ impl ConditionallySelectable for Fr {
|
|||
}
|
||||
}
|
||||
|
||||
impl Sum for Fr {
|
||||
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
|
||||
iter.fold(Self::zero(), ::std::ops::Add::add)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'r> Sum<&'r Fr> for Fr {
|
||||
fn sum<I: Iterator<Item = &'r Fr>>(iter: I) -> Self {
|
||||
iter.fold(Self::zero(), ::std::ops::Add::add)
|
||||
}
|
||||
}
|
||||
|
||||
impl Neg for Fr {
|
||||
type Output = Self;
|
||||
|
||||
|
|
Loading…
Reference in New Issue