use num::traits::{Num, NumCast};
use super::mm::{MM, ToMM};
use super::m::{M, ToM};
use super::km::{KM, ToKM};
pub trait ToCM<T>{
fn to_cm(self) -> CM<T>;
}
unit!(CM);
impl<T: Num+NumCast> ToMM<T> for CM<T> {
fn to_mm(self) -> MM<T> {
MM(self.0 * T::from(10).unwrap())
}
}
impl<T: Num+NumCast> ToCM<T> for CM<T> {
fn to_cm(self) -> CM<T> {
self
}
}
impl<T: Num+NumCast> ToM<T> for CM<T> {
fn to_m(self) -> M<T> {
M(self.0 / T::from(100).unwrap())
}
}
impl<T: Num+NumCast> ToKM<T> for CM<T> {
fn to_km(self) -> KM<T> {
KM(self.0 / T::from(100000).unwrap())
}
}