Trait rational_deduction::Ratio [−][src]
Ratio Trait
Required methods
fn new(top: V, bot: V) -> Self
[src]
Create a new ratio from two base type elements.
fn cases(&self) -> RatioPairRef<'_, V>
[src]
Get reference to top and bottom of ratio.
Provided methods
fn top(self) -> V
[src]
Get the top element.
fn top_ref(&self) -> &V
[src]
Get reference to the top element.
fn bot(self) -> V
[src]
Get the bottom element.
fn bot_ref(&self) -> &V
[src]
Get reference to the bottom element.
fn from_pair(pair: RatioPair<V>) -> Self
[src]
Convert from a RatioPair
.
fn reverse(self) -> Self
[src]
Reverse a Ratio
.
fn default() -> Self where
V: Default,
[src]
V: Default,
Get the default ratio.
fn clone(&self) -> Self where
V: Clone,
[src]
V: Clone,
Clone a Ratio
.
fn eq<RV, R>(&self, other: &R) -> bool where
R: Ratio<RV>,
V: PartialEq<RV>,
[src]
R: Ratio<RV>,
V: PartialEq<RV>,
Check if two Ratio
s are equal.
fn eq_by<RV, R, F>(&self, other: &R, eq: F) -> bool where
R: Ratio<RV>,
F: FnMut(&V, &RV) -> bool,
[src]
R: Ratio<RV>,
F: FnMut(&V, &RV) -> bool,
Check if two Ratio
s are equal given the comparison function.
fn eq_by_symmetric_cancellation<RV, R, F>(&self, other: &R, eq: F) -> bool where
R: Ratio<RV>,
F: FnMut(&V, &RV) -> bool,
[src]
R: Ratio<RV>,
F: FnMut(&V, &RV) -> bool,
Check if two Ratio
s are equal by checking if they cancel symmetrically.
fn pair_compose<T>(top: Self, bot: Self) -> Self where
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
V::Item: PartialEq,
[src]
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
V::Item: PartialEq,
Compose two ratios using the ratio monoid multiplication algorithm.
fn pair_compose_by<F>(top: Self, bot: Self, eq: F) -> Self where
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
F: FnMut(&V::Item, &V::Item) -> bool,
[src]
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
F: FnMut(&V::Item, &V::Item) -> bool,
Compose two ratios using the ratio monoid multiplication algorithm.
fn compose<I>(ratios: I) -> Self where
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
V::Item: PartialEq,
I: IntoIterator<Item = Self>,
[src]
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
V::Item: PartialEq,
I: IntoIterator<Item = Self>,
Fold a collection of ratios using pair_compose
.
fn compose_by<I, F>(ratios: I, eq: F) -> Self where
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
I: IntoIterator<Item = Self>,
F: FnMut(&V::Item, &V::Item) -> bool,
[src]
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
I: IntoIterator<Item = Self>,
F: FnMut(&V::Item, &V::Item) -> bool,
Fold a collection of ratios using pair_compose_by
.
fn has_cancellation(top: &Self, bot: &Self) -> bool where
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
V::Item: PartialEq,
[src]
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
V::Item: PartialEq,
Check if there would be any cancellation if you composed the two elements.
fn has_cancellation_by<F>(top: &Self, bot: &Self, eq: F) -> bool where
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
F: FnMut(&V::Item, &V::Item) -> bool,
[src]
V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
F: FnMut(&V::Item, &V::Item) -> bool,
Check if there would be any cancellation if you composed the two elements.