pub trait Adder {
type Carry;
type Sum;
// Required method
fn adder(&self, other: &Self, carry: &Self) -> (Self::Sum, Self::Carry);
}
Expand description
A single-bit binary adder with a carry bit.
https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder
sum = (a XOR b) XOR carry carry = a AND b OR carry AND (a XOR b) return (sum, carry)
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.