Struct ckb_rational::RationalU256 [−][src]
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]
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.
fn add(self, rhs: &RationalU256) -> RationalU256
[src]
impl Add<&'_ RationalU256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the +
operator.
fn add(self, rhs: &RationalU256) -> RationalU256
[src]
impl Add<&'_ U256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the +
operator.
fn add(self, rhs: &U256) -> RationalU256
[src]
impl Add<&'_ U256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the +
operator.
fn add(self, rhs: &U256) -> RationalU256
[src]
impl Add<RationalU256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the +
operator.
fn add(self, rhs: RationalU256) -> RationalU256
[src]
impl Add<RationalU256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the +
operator.
fn add(self, rhs: RationalU256) -> RationalU256
[src]
impl Add<U256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the +
operator.
fn add(self, rhs: U256) -> RationalU256
[src]
impl Add<U256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the +
operator.
fn add(self, rhs: U256) -> RationalU256
[src]
impl Clone for RationalU256
[src]
fn clone(&self) -> RationalU256
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for RationalU256
[src]
impl<'de> Deserialize<'de> for RationalU256
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for RationalU256
[src]
impl Div<&'_ RationalU256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the /
operator.
fn div(self, rhs: &RationalU256) -> RationalU256
[src]
impl Div<&'_ RationalU256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the /
operator.
fn div(self, rhs: &RationalU256) -> RationalU256
[src]
impl Div<&'_ U256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the /
operator.
fn div(self, rhs: &U256) -> RationalU256
[src]
impl Div<&'_ U256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the /
operator.
fn div(self, rhs: &U256) -> RationalU256
[src]
impl Div<RationalU256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the /
operator.
fn div(self, rhs: RationalU256) -> RationalU256
[src]
impl Div<RationalU256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the /
operator.
fn div(self, rhs: RationalU256) -> RationalU256
[src]
impl Div<U256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the /
operator.
fn div(self, rhs: U256) -> RationalU256
[src]
impl Div<U256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the /
operator.
fn div(self, rhs: U256) -> RationalU256
[src]
impl Eq for RationalU256
[src]
impl Mul<&'_ RationalU256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the *
operator.
fn mul(self, rhs: &RationalU256) -> RationalU256
[src]
impl Mul<&'_ RationalU256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the *
operator.
fn mul(self, rhs: &RationalU256) -> RationalU256
[src]
impl Mul<&'_ U256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the *
operator.
fn mul(self, rhs: &U256) -> RationalU256
[src]
impl Mul<&'_ U256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the *
operator.
fn mul(self, rhs: &U256) -> RationalU256
[src]
impl Mul<RationalU256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the *
operator.
fn mul(self, rhs: RationalU256) -> RationalU256
[src]
impl Mul<RationalU256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the *
operator.
fn mul(self, rhs: RationalU256) -> RationalU256
[src]
impl Mul<U256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the *
operator.
fn mul(self, rhs: U256) -> RationalU256
[src]
impl Mul<U256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the *
operator.
fn mul(self, rhs: U256) -> RationalU256
[src]
impl Ord for RationalU256
[src]
fn cmp(&self, other: &RationalU256) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<RationalU256> for RationalU256
[src]
fn eq(&self, other: &RationalU256) -> bool
[src]
fn ne(&self, other: &RationalU256) -> bool
[src]
impl PartialOrd<RationalU256> for RationalU256
[src]
fn partial_cmp(&self, other: &RationalU256) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for RationalU256
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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.
fn sub(self, rhs: &RationalU256) -> RationalU256
[src]
impl Sub<&'_ RationalU256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the -
operator.
fn sub(self, rhs: &RationalU256) -> RationalU256
[src]
impl Sub<&'_ U256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the -
operator.
fn sub(self, rhs: &U256) -> RationalU256
[src]
impl Sub<&'_ U256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the -
operator.
fn sub(self, rhs: &U256) -> RationalU256
[src]
impl Sub<RationalU256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the -
operator.
fn sub(self, rhs: RationalU256) -> RationalU256
[src]
impl Sub<RationalU256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the -
operator.
fn sub(self, rhs: RationalU256) -> RationalU256
[src]
impl Sub<U256> for RationalU256
[src]
type Output = RationalU256
The resulting type after applying the -
operator.
fn sub(self, rhs: U256) -> RationalU256
[src]
impl Sub<U256> for &RationalU256
[src]
type Output = RationalU256
The resulting type after applying the -
operator.
fn sub(self, rhs: U256) -> RationalU256
[src]
Auto Trait Implementations
impl RefUnwindSafe for RationalU256
impl Send for RationalU256
impl Sync for RationalU256
impl Unpin for RationalU256
impl UnwindSafe for RationalU256
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,