pub struct Fraction<T> {
pub num: T,
pub den: T,
}Expand description
A numerator paired with its denominator.
Fractional addition never touches one half alone:
a_0/b_0 + a_1/b_1 = (a_0*b_1 + a_1*b_0) / (b_0*b_1)So the two travel together, through every layer and every claim. Pairing them in one type makes a half-formed pair unrepresentable. A bare tuple leaves each caller to remember which element is which.
T is whatever stands for one half.
A scalar gives a claimed fraction; a column buffer gives one layer of the circuit.
Fields§
§num: TThe numerator.
den: TThe denominator.
Implementations§
Source§impl<T> Fraction<T>
impl<T> Fraction<T>
Trait Implementations§
impl<T: Copy> Copy for Fraction<T>
impl<T: Eq> Eq for Fraction<T>
Source§impl<T: PartialEq> PartialEq for Fraction<T>
impl<T: PartialEq> PartialEq for Fraction<T>
impl<T: PartialEq> StructuralPartialEq for Fraction<T>
Auto Trait Implementations§
impl<T> Freeze for Fraction<T>where
T: Freeze,
impl<T> RefUnwindSafe for Fraction<T>where
T: RefUnwindSafe,
impl<T> Send for Fraction<T>where
T: Send,
impl<T> Sync for Fraction<T>where
T: Sync,
impl<T> Unpin for Fraction<T>where
T: Unpin,
impl<T> UnsafeUnpin for Fraction<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Fraction<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more