26 lines
384 B
Rust
26 lines
384 B
Rust
|
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 {
|
||
|
|
||
|
}
|