units.rs (hyperfine-1.14.0) | : | units.rs (hyperfine-1.15.0) | ||
---|---|---|---|---|
//! This module contains common units. | //! This module contains common units. | |||
pub type Scalar = f64; | pub type Scalar = f64; | |||
/// Type alias for unit of time | /// Type alias for unit of time | |||
pub type Second = Scalar; | pub type Second = Scalar; | |||
/// Supported time units | /// Supported time units | |||
#[derive(Debug, Clone, Copy, PartialEq)] | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | |||
pub enum Unit { | pub enum Unit { | |||
Second, | Second, | |||
MilliSecond, | MilliSecond, | |||
} | } | |||
impl Unit { | impl Unit { | |||
/// The abbreviation of the Unit. | /// The abbreviation of the Unit. | |||
pub fn short_name(self) -> String { | pub fn short_name(self) -> String { | |||
match self { | match self { | |||
Unit::Second => String::from("s"), | Unit::Second => String::from("s"), | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |