Trait rational_deduction::Ratio[][src]

pub trait Ratio<V> where
    Self: Into<RatioPair<V>>, 
{ fn new(top: V, bot: V) -> Self;
fn cases(&self) -> RatioPairRef<'_, V>; fn top(self) -> V { ... }
fn top_ref(&self) -> &V { ... }
fn bot(self) -> V { ... }
fn bot_ref(&self) -> &V { ... }
fn from_pair(pair: RatioPair<V>) -> Self { ... }
fn reverse(self) -> Self { ... }
fn default() -> Self
    where
        V: Default
, { ... }
fn clone(&self) -> Self
    where
        V: Clone
, { ... }
fn eq<RV, R>(&self, other: &R) -> bool
    where
        R: Ratio<RV>,
        V: PartialEq<RV>
, { ... }
fn eq_by<RV, R, F>(&self, other: &R, eq: F) -> bool
    where
        R: Ratio<RV>,
        F: FnMut(&V, &RV) -> bool
, { ... }
fn eq_by_symmetric_cancellation<RV, R, F>(&self, other: &R, eq: F) -> bool
    where
        R: Ratio<RV>,
        F: FnMut(&V, &RV) -> bool
, { ... }
fn pair_compose<T>(top: Self, bot: Self) -> Self
    where
        V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
        V::Item: PartialEq
, { ... }
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
, { ... }
fn compose<I>(ratios: I) -> Self
    where
        V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
        V::Item: PartialEq,
        I: IntoIterator<Item = Self>
, { ... }
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
, { ... }
fn has_cancellation(top: &Self, bot: &Self) -> bool
    where
        V: IntoIterator + FromIterator<<V as IntoIterator>::Item>,
        V::Item: PartialEq
, { ... }
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
, { ... } }

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.

Loading content...

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]

Get the default ratio.

fn clone(&self) -> Self where
    V: Clone
[src]

Clone a Ratio.

fn eq<RV, R>(&self, other: &R) -> bool where
    R: Ratio<RV>,
    V: PartialEq<RV>, 
[src]

Check if two Ratios are equal.

fn eq_by<RV, R, F>(&self, other: &R, eq: F) -> bool where
    R: Ratio<RV>,
    F: FnMut(&V, &RV) -> bool, 
[src]

Check if two Ratios 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]

Check if two Ratios 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]

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]

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]

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]

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]

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]

Check if there would be any cancellation if you composed the two elements.

Loading content...

Implementors

impl<V> Ratio<V> for (V, V)[src]

impl<V> Ratio<V> for RatioPair<V>[src]

Loading content...