Trait lemonmath::helper::VecToFraction
source · [−]pub trait VecToFraction {
fn to_fraction(self) -> Vec<Fraction>;
}
Expand description
This turns a Vector of numbers into a Vector of Fractions
Examples
use lemonmath::helper::VecToFraction;
use lemonmath::fraction::Fraction;
let x = vec![1u8, 2u8, 3u8, 4u8, 5u8].to_fraction();
assert_eq!(x[0], Fraction::new(1, 1));
assert_eq!(x[1], Fraction::new(2, 1));
assert_eq!(x[2], Fraction::new(3, 1));
assert_eq!(x[3], Fraction::new(4, 1));
assert_eq!(x[4], Fraction::new(5, 1));