Struct Mpq

Source
pub struct Mpq { /* private fields */ }

Implementations§

Source§

impl Mpq

Source

pub unsafe fn inner(&self) -> mpq_srcptr

Source

pub unsafe fn inner_mut(&mut self) -> mpq_ptr

Source

pub fn new() -> Mpq

Source

pub fn ratio(num: &Mpz, den: &Mpz) -> Mpq

Source

pub fn from_str_radix(s: &str, base: u8) -> Result<Mpq, ParseMpqError>

Source

pub fn set(&mut self, other: &Mpq)

Source

pub fn set_z(&mut self, other: &Mpz)

Source

pub fn set_d(&mut self, other: f64)

Source

pub fn set_f(&mut self, other: &Mpf)

Source

pub fn get_num(&self) -> Mpz

Source

pub fn get_den(&self) -> Mpz

Source

pub fn abs(&self) -> Mpq

Source

pub fn invert(&self) -> Mpq

Source

pub fn floor(&self) -> Mpz

Source

pub fn ceil(&self) -> Mpz

Source

pub fn sign(&self) -> Sign

Source

pub fn one() -> Mpq

Source

pub fn zero() -> Mpq

Source

pub fn is_zero(&self) -> bool

Trait Implementations§

Source§

impl<'a, 'b> Add<&'a Mpq> for &'b Mpq

Source§

type Output = Mpq

The resulting type after applying the + operator.
Source§

fn add(self, other: &Mpq) -> Mpq

Performs the + operation. Read more
Source§

impl<'a> Add<&'a Mpq> for Mpq

Source§

type Output = Mpq

The resulting type after applying the + operator.
Source§

fn add(self, other: &Mpq) -> Mpq

Performs the + operation. Read more
Source§

impl<'a> Add<Mpq> for &'a Mpq

Source§

type Output = Mpq

The resulting type after applying the + operator.
Source§

fn add(self, other: Mpq) -> Mpq

Performs the + operation. Read more
Source§

impl Add for Mpq

Source§

type Output = Mpq

The resulting type after applying the + operator.
Source§

fn add(self, other: Mpq) -> Mpq

Performs the + operation. Read more
Source§

impl<'a> AddAssign<&'a Mpq> for Mpq

Source§

fn add_assign(&mut self, other: &Mpq)

Performs the += operation. Read more
Source§

impl<'a> AddAssign for Mpq

Source§

fn add_assign(&mut self, other: Mpq)

Performs the += operation. Read more
Source§

impl Clone for Mpq

Source§

fn clone(&self) -> Mpq

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Mpq

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Renders as numer/denom. If denom=1, renders as numer.

Source§

impl Display for Mpq

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Renders as numer/denom. If denom=1, renders as numer.

Source§

impl<'a, 'b> Div<&'a Mpq> for &'b Mpq

Source§

type Output = Mpq

The resulting type after applying the / operator.
Source§

fn div(self, other: &Mpq) -> Mpq

Performs the / operation. Read more
Source§

impl<'a> Div<&'a Mpq> for Mpq

Source§

type Output = Mpq

The resulting type after applying the / operator.
Source§

fn div(self, other: &Mpq) -> Mpq

Performs the / operation. Read more
Source§

impl<'a> Div<Mpq> for &'a Mpq

Source§

type Output = Mpq

The resulting type after applying the / operator.
Source§

fn div(self, other: Mpq) -> Mpq

Performs the / operation. Read more
Source§

impl Div for Mpq

Source§

type Output = Mpq

The resulting type after applying the / operator.
Source§

fn div(self, other: Mpq) -> Mpq

Performs the / operation. Read more
Source§

impl<'a> DivAssign<&'a Mpq> for Mpq

Source§

fn div_assign(&mut self, other: &Mpq)

Performs the /= operation. Read more
Source§

impl<'a> DivAssign for Mpq

Source§

fn div_assign(&mut self, other: Mpq)

Performs the /= operation. Read more
Source§

impl Drop for Mpq

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> From<&'a Mpq> for f64

Source§

fn from(other: &Mpq) -> f64

Converts to this type from the input type.
Source§

impl<'a> From<&'a Mpz> for Mpq

Source§

fn from(other: &Mpz) -> Mpq

Converts to this type from the input type.
Source§

impl From<Mpq> for f64

Source§

fn from(other: Mpq) -> f64

Converts to this type from the input type.
Source§

impl From<Mpz> for Mpq

Source§

fn from(other: Mpz) -> Mpq

Converts to this type from the input type.
Source§

impl From<i32> for Mpq

Source§

fn from(other: i32) -> Mpq

Converts to this type from the input type.
Source§

impl From<i64> for Mpq

Source§

fn from(other: i64) -> Mpq

Converts to this type from the input type.
Source§

impl From<u32> for Mpq

Source§

fn from(other: u32) -> Mpq

Converts to this type from the input type.
Source§

impl From<u64> for Mpq

Source§

fn from(other: u64) -> Mpq

Converts to this type from the input type.
Source§

impl FromStr for Mpq

Source§

type Err = ParseMpqError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Mpq, ParseMpqError>

Parses a string s to return a value of this type. Read more
Source§

impl<'a, 'b> Mul<&'a Mpq> for &'b Mpq

Source§

type Output = Mpq

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Mpq) -> Mpq

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Mpq> for Mpq

Source§

type Output = Mpq

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Mpq) -> Mpq

Performs the * operation. Read more
Source§

impl<'a> Mul<Mpq> for &'a Mpq

Source§

type Output = Mpq

The resulting type after applying the * operator.
Source§

fn mul(self, other: Mpq) -> Mpq

Performs the * operation. Read more
Source§

impl Mul for Mpq

Source§

type Output = Mpq

The resulting type after applying the * operator.
Source§

fn mul(self, other: Mpq) -> Mpq

Performs the * operation. Read more
Source§

impl<'a> MulAssign<&'a Mpq> for Mpq

Source§

fn mul_assign(&mut self, other: &Mpq)

Performs the *= operation. Read more
Source§

impl<'a> MulAssign for Mpq

Source§

fn mul_assign(&mut self, other: Mpq)

Performs the *= operation. Read more
Source§

impl<'b> Neg for &'b Mpq

Source§

type Output = Mpq

The resulting type after applying the - operator.
Source§

fn neg(self) -> Mpq

Performs the unary - operation. Read more
Source§

impl Neg for Mpq

Source§

type Output = Mpq

The resulting type after applying the - operator.
Source§

fn neg(self) -> Mpq

Performs the unary - operation. Read more
Source§

impl One for Mpq

Source§

fn one() -> Mpq

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl Ord for Mpq

Source§

fn cmp(&self, other: &Mpq) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Mpq

Source§

fn eq(&self, other: &Mpq) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Mpq

Source§

fn partial_cmp(&self, other: &Mpq) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, 'b> Sub<&'a Mpq> for &'b Mpq

Source§

type Output = Mpq

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Mpq) -> Mpq

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a Mpq> for Mpq

Source§

type Output = Mpq

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Mpq) -> Mpq

Performs the - operation. Read more
Source§

impl<'a> Sub<Mpq> for &'a Mpq

Source§

type Output = Mpq

The resulting type after applying the - operator.
Source§

fn sub(self, other: Mpq) -> Mpq

Performs the - operation. Read more
Source§

impl Sub for Mpq

Source§

type Output = Mpq

The resulting type after applying the - operator.
Source§

fn sub(self, other: Mpq) -> Mpq

Performs the - operation. Read more
Source§

impl<'a> SubAssign<&'a Mpq> for Mpq

Source§

fn sub_assign(&mut self, other: &Mpq)

Performs the -= operation. Read more
Source§

impl<'a> SubAssign for Mpq

Source§

fn sub_assign(&mut self, other: Mpq)

Performs the -= operation. Read more
Source§

impl Zero for Mpq

Source§

fn zero() -> Mpq

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl Eq for Mpq

Source§

impl Send for Mpq

Source§

impl Sync for Mpq

Auto Trait Implementations§

§

impl Freeze for Mpq

§

impl RefUnwindSafe for Mpq

§

impl Unpin for Mpq

§

impl UnwindSafe for Mpq

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.