pub struct RationalValue { /* private fields */ }Expand description
An exact normalized rational number.
Implementations§
Source§impl RationalValue
impl RationalValue
Sourcepub fn new(numerator: i64, denominator: u64) -> Result<Self>
pub fn new(numerator: i64, denominator: u64) -> Result<Self>
Creates a rational value reduced to lowest terms.
§Errors
Returns ErrorKind::InvalidArgument when denominator is zero.
Sourcepub const fn denominator(self) -> u64
pub const fn denominator(self) -> u64
Returns the positive normalized denominator.
Trait Implementations§
Source§impl Clone for RationalValue
impl Clone for RationalValue
Source§fn clone(&self) -> RationalValue
fn clone(&self) -> RationalValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RationalValue
Source§impl Debug for RationalValue
impl Debug for RationalValue
impl Eq for RationalValue
Source§impl Hash for RationalValue
impl Hash for RationalValue
Source§impl PartialEq for RationalValue
impl PartialEq for RationalValue
Source§fn eq(&self, other: &RationalValue) -> bool
fn eq(&self, other: &RationalValue) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RationalValue
Auto Trait Implementations§
impl Freeze for RationalValue
impl RefUnwindSafe for RationalValue
impl Send for RationalValue
impl Sync for RationalValue
impl Unpin for RationalValue
impl UnsafeUnpin for RationalValue
impl UnwindSafe for RationalValue
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