#[non_exhaustive]pub struct Fraction {
pub numerator: i64,
pub denominator: i64,
/* private fields */
}Expand description
Represents a fraction in terms of a numerator divided by a denominator.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.numerator: i64The numerator in the fraction, e.g. 2 in 2/3.
denominator: i64The value by which the numerator is divided, e.g. 3 in 2/3. Must be positive.
Implementations§
Source§impl Fraction
impl Fraction
pub fn new() -> Self
Sourcepub fn set_numerator<T: Into<i64>>(self, v: T) -> Self
pub fn set_numerator<T: Into<i64>>(self, v: T) -> Self
Sets the value of numerator.
Sourcepub fn set_denominator<T: Into<i64>>(self, v: T) -> Self
pub fn set_denominator<T: Into<i64>>(self, v: T) -> Self
Sets the value of denominator.
Trait Implementations§
impl StructuralPartialEq for Fraction
Auto Trait Implementations§
impl Freeze for Fraction
impl RefUnwindSafe for Fraction
impl Send for Fraction
impl Sync for Fraction
impl Unpin for Fraction
impl UnwindSafe for Fraction
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