Skip to content

Commit

Permalink
Merge pull request #129 from cuviper/into_raw
Browse files Browse the repository at this point in the history
Add `Ratio::into_raw`
  • Loading branch information
cuviper authored May 8, 2024
2 parents 33c9385 + 7ae0b88 commit fef7db2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ impl<T> Ratio<T> {
Ratio { numer, denom }
}

/// Deconstructs a `Ratio` into its numerator and denominator.
#[inline]
pub fn into_raw(self) -> (T, T) {
(self.numer, self.denom)
}

/// Gets an immutable reference to the numerator.
#[inline]
pub const fn numer(&self) -> &T {
Expand Down

0 comments on commit fef7db2

Please sign in to comment.