pub struct Rational {
pub numerator: i32,
pub denominator: NonZero<i32>,
}
Expand description
A rational number.
Fields§
§numerator: i32
Numerator.
denominator: NonZero<i32>
Denominator.
Implementations§
Source§impl Rational
impl Rational
Sourcepub const fn new(numerator: i32, denominator: NonZero<i32>) -> Self
pub const fn new(numerator: i32, denominator: NonZero<i32>) -> Self
Create a new rational number.
Sourcepub const fn static_new<const N: i32, const D: i32>() -> Self
pub const fn static_new<const N: i32, const D: i32>() -> Self
Sourcepub fn from_f64_rounded(value: f64) -> Self
pub fn from_f64_rounded(value: f64) -> Self
Create a new rational number from a floating point number. The number might be truncated.
Trait Implementations§
Source§impl From<AVRational> for Rational
impl From<AVRational> for Rational
Source§fn from(rational: AVRational) -> Self
fn from(rational: AVRational) -> Self
Converts to this type from the input type.
Source§impl From<Rational> for AVRational
impl From<Rational> for AVRational
impl Copy for Rational
impl Eq for Rational
impl StructuralPartialEq for Rational
Auto Trait Implementations§
impl Freeze for Rational
impl RefUnwindSafe for Rational
impl Send for Rational
impl Sync for Rational
impl Unpin for Rational
impl UnwindSafe for Rational
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more