Skip to content

Commit 1f8a020

Browse files
committed
add numer_mut() denom_mut()
1 parent 4d55ad2 commit 1f8a020

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ impl<T> Ratio<T> {
9898
pub const fn denom(&self) -> &T {
9999
&self.denom
100100
}
101+
102+
/// Gets an mutable reference to the numerator.
103+
#[inline]
104+
pub const fn numer_mut(&mut self) -> &mut T {
105+
&mut self.numer
106+
}
107+
108+
/// Gets an mutable reference to the denominator.
109+
#[inline]
110+
pub const fn denom_mut(&mut self) -> &mut T {
111+
&mut self.denom
112+
}
101113
}
102114

103115
impl<T: Clone + Integer> Ratio<T> {

0 commit comments

Comments
 (0)