rusty-numbers/src/rational.rs

26 lines
384 B
Rust
Raw Normal View History

2020-02-12 22:29:57 -05:00
use crate::Unsigned;
pub enum FracType<T: Unsigned = usize> {
Proper(T, Frac),
Improper(Frac),
}
pub struct Frac<T: Unsigned = usize> {
numer: T,
denom: T,
}
impl<T: Unsigned> Frac<T> {
/// Create a new rational number
pub fn new(n: T, d: T) -> Self {
Frac {
numer: n,
denom: d,
}
}
}
#[cfg(test)]
mod tests {
}