Skip to content

Commit c140433

Browse files
committed
Allow negation of AllowedConversions.
1 parent d38ab0e commit c140433

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

masp_primitives/src/convert.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::collections::BTreeMap;
1616
use std::{
1717
io::{self, Write},
1818
iter::Sum,
19-
ops::{Add, AddAssign, Sub, SubAssign},
19+
ops::{Add, AddAssign, Neg, Sub, SubAssign},
2020
};
2121

2222
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -196,6 +196,17 @@ impl SubAssign for AllowedConversion {
196196
}
197197
}
198198

199+
impl Neg for AllowedConversion {
200+
type Output = Self;
201+
202+
fn neg(self) -> Self {
203+
Self {
204+
assets: -self.assets,
205+
generator: -self.generator,
206+
}
207+
}
208+
}
209+
199210
impl Sum for AllowedConversion {
200211
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
201212
iter.fold(AllowedConversion::from(ValueSum::zero()), Add::add)

0 commit comments

Comments
 (0)