Struct ckb_rational::RationalU256[][src]

pub struct RationalU256 { /* fields omitted */ }

Represents the ratio numerator / denominator, where numerator and denominator are both unsigned 256-bit integers.

Implementations

impl RationalU256[src]

pub fn new(numer: U256, denom: U256) -> RationalU256[src]

Creates a new ratio numer / denom.

Panics

Panics when denom is zero.

pub const fn new_raw(numer: U256, denom: U256) -> RationalU256[src]

Creates a new ratio numer / denom without checking whether denom is zero.

pub const fn from_u256(t: U256) -> RationalU256[src]

Creates a new ratio t / 1.

pub fn is_zero(&self) -> bool[src]

Tells whether the numerator is zero.

pub const fn zero() -> RationalU256[src]

Creates a new ratio 0 / 1.

pub const fn one() -> RationalU256[src]

Creates a new ratio 1 / 1.

pub fn into_u256(self) -> U256[src]

Rounds down the ratio into an unsigned 256-bit integer.

pub fn saturating_sub(self, rhs: RationalU256) -> Self[src]

Computes self - rhs and saturates the result to zero when self is less than rhs.

Returns self - rhs when self > rhs, returns zero otherwise.

pub fn saturating_sub_u256(self, rhs: U256) -> Self[src]

Computes self - rhs and saturates the result to zero when self is less than rhs.

Returns self - rhs when self > rhs, returns zero otherwise.

Trait Implementations

impl Add<&'_ RationalU256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the + operator.

impl Add<&'_ RationalU256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the + operator.

impl Add<&'_ U256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the + operator.

impl Add<&'_ U256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the + operator.

impl Add<RationalU256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the + operator.

impl Add<RationalU256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the + operator.

impl Add<U256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the + operator.

impl Add<U256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the + operator.

impl Clone for RationalU256[src]

impl Debug for RationalU256[src]

impl<'de> Deserialize<'de> for RationalU256[src]

impl Display for RationalU256[src]

impl Div<&'_ RationalU256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the / operator.

impl Div<&'_ RationalU256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the / operator.

impl Div<&'_ U256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the / operator.

impl Div<&'_ U256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the / operator.

impl Div<RationalU256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the / operator.

impl Div<RationalU256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the / operator.

impl Div<U256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the / operator.

impl Div<U256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the / operator.

impl Eq for RationalU256[src]

impl Mul<&'_ RationalU256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the * operator.

impl Mul<&'_ RationalU256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the * operator.

impl Mul<&'_ U256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the * operator.

impl Mul<&'_ U256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the * operator.

impl Mul<RationalU256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the * operator.

impl Mul<RationalU256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the * operator.

impl Mul<U256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the * operator.

impl Mul<U256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the * operator.

impl Ord for RationalU256[src]

impl PartialEq<RationalU256> for RationalU256[src]

impl PartialOrd<RationalU256> for RationalU256[src]

impl Serialize for RationalU256[src]

impl StructuralEq for RationalU256[src]

impl StructuralPartialEq for RationalU256[src]

impl Sub<&'_ RationalU256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the - operator.

impl Sub<&'_ RationalU256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the - operator.

impl Sub<&'_ U256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the - operator.

impl Sub<&'_ U256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the - operator.

impl Sub<RationalU256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the - operator.

impl Sub<RationalU256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the - operator.

impl Sub<U256> for RationalU256[src]

type Output = RationalU256

The resulting type after applying the - operator.

impl Sub<U256> for &RationalU256[src]

type Output = RationalU256

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,