1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
use std::fmt; use std::fmt::Display; #[derive(Debug,Clone,Copy)] pub enum RoundingMode { Default, Upward, Downward, Nearest, ToZero } impl Display for RoundingMode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { RoundingMode::Default => write!(f, "Default Rounding"), RoundingMode::Upward => write!(f, "Upward Rounding"), RoundingMode::Downward => write!(f, "Downward Rounding"), RoundingMode::Nearest => write!(f, "To nearest Rounding"), RoundingMode::ToZero => write!(f, "Toward Zero Rounding"), } } }