From ae0c4e650a15bda9466723489615dd551410eb49 Mon Sep 17 00:00:00 2001 From: Marcel Hellwig Date: Thu, 15 Nov 2018 09:53:47 +0100 Subject: [PATCH] remove initial_value from resolve --- src/integer.rs | 3 --- src/logicbit/ieee1164.rs | 2 +- src/logicbit/mac.rs | 14 +------------- src/logicbit/mod.rs | 1 - 4 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/integer.rs b/src/integer.rs index 187acef..3eefed4 100644 --- a/src/integer.rs +++ b/src/integer.rs @@ -17,9 +17,6 @@ impl<'a, 'b> Resolve<&'b Integer> for &'a Integer { width: self.width, } } - fn initial_value(&self) -> Integer { - Integer::new_with_value(0u8, self.width()) - } } impl PartialEq for Integer { diff --git a/src/logicbit/ieee1164.rs b/src/logicbit/ieee1164.rs index d299f75..d519561 100644 --- a/src/logicbit/ieee1164.rs +++ b/src/logicbit/ieee1164.rs @@ -164,7 +164,7 @@ fn resolve(a: Ieee1164, b: Ieee1164) -> Ieee1164 { ]; TTABLE[a.to_index()][b.to_index()] } -expand_resolve_op!(resolve, Ieee1164, Ieee1164, Ieee1164, _Z); +expand_resolve_op!(resolve, Ieee1164, Ieee1164, Ieee1164); impl fmt::Display for Ieee1164 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/logicbit/mac.rs b/src/logicbit/mac.rs index 1c11382..c5a180b 100644 --- a/src/logicbit/mac.rs +++ b/src/logicbit/mac.rs @@ -1,40 +1,28 @@ macro_rules! expand_resolve_op { - ($func_name:ident, $for_type:ty, $output_type:ty, $rhs:ty, $initial:ident) => { + ($func_name:ident, $for_type:ty, $output_type:ty, $rhs:ty) => { impl Resolve<$rhs> for $for_type { type Output = $output_type; fn resolve(self, rhs: $rhs) -> Self::Output { $func_name(self, rhs) } - fn initial_value(&self) -> Self::Output { - $initial - } } impl<'a> Resolve<$rhs> for &'a $for_type { type Output = $output_type; fn resolve(self, rhs: $rhs) -> Self::Output { $func_name(*self, rhs) } - fn initial_value(&self) -> Self::Output { - $initial - } } impl<'b> Resolve<&'b $rhs> for $for_type { type Output = $output_type; fn resolve(self, rhs: &'b $rhs) -> Self::Output { $func_name(self, *rhs) } - fn initial_value(&self) -> Self::Output { - $initial - } } impl<'a, 'b> Resolve<&'b $rhs> for &'a $for_type { type Output = $output_type; fn resolve(self, rhs: &'b $rhs) -> Self::Output { $func_name(*self, *rhs) } - fn initial_value(&self) -> Self::Output { - $initial - } } }; } diff --git a/src/logicbit/mod.rs b/src/logicbit/mod.rs index 4f6f360..5d7b081 100644 --- a/src/logicbit/mod.rs +++ b/src/logicbit/mod.rs @@ -13,5 +13,4 @@ pub use self::tvlogic::Ieee1164Value; pub trait Resolve { type Output: ?Sized; fn resolve(self, rhs: RHS) -> Self::Output; - fn initial_value(&self) -> Self::Output; }