use super::*;
impl<N: Network> Eq for Value<N> {}
impl<N: Network> PartialEq for Value<N> {
fn eq(&self, other: &Self) -> bool {
*self.is_equal(other)
}
}
impl<N: Network> Equal<Self> for Value<N> {
type Output = Boolean<N>;
fn is_equal(&self, other: &Self) -> Self::Output {
match (self, other) {
(Self::Plaintext(a), Self::Plaintext(b)) => a.is_equal(b),
(Self::Record(a), Self::Record(b)) => a.is_equal(b),
(Self::Future(a), Self::Future(b)) => a.is_equal(b),
(Self::Plaintext(..), _) | (Self::Record(..), _) | (Self::Future(..), _) => Boolean::new(false),
}
}
fn is_not_equal(&self, other: &Self) -> Self::Output {
match (self, other) {
(Self::Plaintext(a), Self::Plaintext(b)) => a.is_not_equal(b),
(Self::Record(a), Self::Record(b)) => a.is_not_equal(b),
(Self::Future(a), Self::Future(b)) => a.is_not_equal(b),
(Self::Plaintext(..), _) | (Self::Record(..), _) | (Self::Future(..), _) => Boolean::new(true),
}
}
}