Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/fixed_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down