diff --git a/src/fixed_point.rs b/src/fixed_point.rs index dcb52aa..714aed6 100644 --- a/src/fixed_point.rs +++ b/src/fixed_point.rs @@ -29,6 +29,17 @@ pub trait FixedPoint: Sized + Copy { /// ``` fn integer(&self) -> Self::T; + /// Returns the _scaling factor_ [`Fraction`] part + /// + /// ```rust + /// # use embedded_time::{ rate::*}; + /// # + /// assert_eq!(Kilohertz(45_u32).scaling_factor(), Fraction::new(1_000, 1)); + /// ``` + fn scaling_factor(&self) -> Fraction { + Self::SCALING_FACTOR + } + /// Constructs a `FixedPoint` value from _integer_ and _scaling-factor_ ([`Fraction`]) parts /// /// # Errors