pub trait SignStrExt {
fn sign_str(self) -> &'static str;
fn sign_sn(self) -> &'static str;
fn sign_we(self) -> &'static str;
}
macro_rules! impl_sign_str {
($t:ty, $zero:expr) => {
impl SignStrExt for $t {
#[inline] fn sign_str(self) -> &'static str { if self >= $zero { "+" } else { "-" } }
#[inline] fn sign_sn(self) -> &'static str { if self >= $zero { "N" } else { "S" } }
#[inline] fn sign_we(self) -> &'static str { if self >= $zero { "E" } else { "W" } }
}
};
}
impl_sign_str!(f64, 0.0);
impl_sign_str!(i8, 0);
impl_sign_str!(i16, 0);