mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-23 01:51:06 +00:00
fraction: refer to numer and denom more consistently
This also lessens the tendency to confuse num with number. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1411>
This commit is contained in:
parent
d138317510
commit
a570625328
1 changed files with 8 additions and 8 deletions
|
@ -16,9 +16,9 @@ impl Fraction {
|
||||||
///
|
///
|
||||||
/// Panics if `denom` is zero.
|
/// Panics if `denom` is zero.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(num: i32, den: i32) -> Self {
|
pub fn new(numer: i32, denom: i32) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
(num, den).into()
|
(numer, denom).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
// rustdoc-stripper-ignore-next
|
// rustdoc-stripper-ignore-next
|
||||||
|
@ -27,9 +27,9 @@ impl Fraction {
|
||||||
/// While this does not panic, there are several methods that will panic
|
/// While this does not panic, there are several methods that will panic
|
||||||
/// if used on a `Fraction` with `denom == 0`.
|
/// if used on a `Fraction` with `denom == 0`.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn new_raw(num: i32, den: i32) -> Self {
|
pub const fn new_raw(numer: i32, denom: i32) -> Self {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
Self(Rational32::new_raw(num, den))
|
Self(Rational32::new_raw(numer, denom))
|
||||||
}
|
}
|
||||||
|
|
||||||
// rustdoc-stripper-ignore-next
|
// rustdoc-stripper-ignore-next
|
||||||
|
@ -66,10 +66,10 @@ impl Fraction {
|
||||||
pub fn simplify(&mut self, n_terms: u32, threshold: u32) {
|
pub fn simplify(&mut self, n_terms: u32, threshold: u32) {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut num = self.numer();
|
let mut numer = self.numer();
|
||||||
let mut den = self.denom();
|
let mut denom = self.denom();
|
||||||
ffi::gst_util_simplify_fraction(&mut num, &mut den, n_terms, threshold);
|
ffi::gst_util_simplify_fraction(&mut numer, &mut denom, n_terms, threshold);
|
||||||
*self = Self::new(num, den);
|
*self = Self::new(numer, denom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue