Skip to content

Commit

Permalink
remove initial_value from resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
hellow554 committed Nov 15, 2018
1 parent 58b09d4 commit ae0c4e6
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
3 changes: 0 additions & 3 deletions src/integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/logicbit/ieee1164.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 1 addition & 13 deletions src/logicbit/mac.rs
Original file line number Diff line number Diff line change
@@ -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
}
}
};
}
1 change: 0 additions & 1 deletion src/logicbit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ pub use self::tvlogic::Ieee1164Value;
pub trait Resolve<RHS = Self> {
type Output: ?Sized;
fn resolve(self, rhs: RHS) -> Self::Output;
fn initial_value(&self) -> Self::Output;
}

0 comments on commit ae0c4e6

Please sign in to comment.