ic_e8s::d

Struct EDs

source
pub struct EDs {
    pub val: BigUint,
    pub decimals: u8,
}
Expand description

Fixed-point decimals with primitive math (+-*/) implemented correctly

Fields§

§val: BigUint§decimals: u8

Implementations§

source§

impl EDs

source

pub fn new(val: BigUint, decimals: u8) -> Self

source

pub fn base(decimals: u8) -> &'static BigUint

source

pub fn zero(decimals: u8) -> Self

source

pub fn one(decimals: u8) -> Self

source

pub fn f0_1(decimals: u8) -> Self

source

pub fn f0_2(decimals: u8) -> Self

source

pub fn f0_25(decimals: u8) -> Self

source

pub fn f0_3(decimals: u8) -> Self

source

pub fn f0_33(decimals: u8) -> Self

source

pub fn f0_4(decimals: u8) -> Self

source

pub fn f0_5(decimals: u8) -> Self

source

pub fn f0_6(decimals: u8) -> Self

source

pub fn f0_67(decimals: u8) -> Self

source

pub fn f0_7(decimals: u8) -> Self

source

pub fn f0_75(decimals: u8) -> Self

source

pub fn f0_8(decimals: u8) -> Self

source

pub fn f0_9(decimals: u8) -> Self

source

pub fn two(decimals: u8) -> Self

source

pub fn sqrt(&self) -> Self

source

pub fn to_const<const D: usize>(self) -> ECs<D>

source

pub fn to_decimals(self, new_decimals: u8) -> EDs

Trait Implementations§

source§

impl Add<&EDs> for EDs

source§

type Output = EDs

The resulting type after applying the + operator.
source§

fn add(self, rhs: &EDs) -> Self::Output

Performs the + operation. Read more
source§

impl Add<EDs> for &EDs

source§

type Output = EDs

The resulting type after applying the + operator.
source§

fn add(self, rhs: EDs) -> Self::Output

Performs the + operation. Read more
source§

impl Add for &EDs

source§

type Output = EDs

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl Add for EDs

source§

type Output = EDs

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<&EDs> for EDs

source§

fn add_assign(&mut self, rhs: &EDs)

Performs the += operation. Read more
source§

impl AddAssign for EDs

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl CandidType for EDs

source§

fn _ty() -> Type

source§

fn idl_serialize<S>(&self, serializer: S) -> Result<(), S::Error>
where S: Serializer,

source§

fn ty() -> Type

source§

fn id() -> TypeId

source§

impl Clone for EDs

source§

fn clone(&self) -> EDs

Returns a copy of the value. Read more
1.6.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for EDs

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for EDs

source§

fn default() -> EDs

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for EDs

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for EDs

source§

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

Formats the value using the given formatter. Read more
source§

impl Div<&EDs> for EDs

source§

type Output = EDs

The resulting type after applying the / operator.
source§

fn div(self, rhs: &EDs) -> Self::Output

Performs the / operation. Read more
source§

impl Div<EDs> for &EDs

source§

type Output = EDs

The resulting type after applying the / operator.
source§

fn div(self, rhs: EDs) -> Self::Output

Performs the / operation. Read more
source§

impl Div<u64> for &EDs

source§

type Output = EDs

The resulting type after applying the / operator.
source§

fn div(self, rhs: u64) -> Self::Output

Performs the / operation. Read more
source§

impl Div<u64> for EDs

source§

type Output = EDs

The resulting type after applying the / operator.
source§

fn div(self, rhs: u64) -> Self::Output

Performs the / operation. Read more
source§

impl Div for &EDs

source§

type Output = EDs

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl Div for EDs

source§

type Output = EDs

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<&EDs> for EDs

source§

fn div_assign(&mut self, rhs: &EDs)

Performs the /= operation. Read more
source§

impl DivAssign<u64> for EDs

source§

fn div_assign(&mut self, rhs: u64)

Performs the /= operation. Read more
source§

impl DivAssign for EDs

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl From<(u64, u8)> for EDs

source§

fn from((value, decimals): (u64, u8)) -> Self

Converts to this type from the input type.
source§

impl Hash for EDs

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.6.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Into<Nat> for &EDs

source§

fn into(self) -> Nat

Converts this type into the (usually inferred) input type.
source§

impl Into<Nat> for EDs

source§

fn into(self) -> Nat

Converts this type into the (usually inferred) input type.
source§

impl Mul<&EDs> for EDs

source§

type Output = EDs

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &EDs) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<EDs> for &EDs

source§

type Output = EDs

The resulting type after applying the * operator.
source§

fn mul(self, rhs: EDs) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<u64> for &EDs

source§

type Output = EDs

The resulting type after applying the * operator.
source§

fn mul(self, rhs: u64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<u64> for EDs

source§

type Output = EDs

The resulting type after applying the * operator.
source§

fn mul(self, rhs: u64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for &EDs

source§

type Output = EDs

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for EDs

source§

type Output = EDs

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<&EDs> for EDs

source§

fn mul_assign(&mut self, rhs: &EDs)

Performs the *= operation. Read more
source§

impl MulAssign<u64> for EDs

source§

fn mul_assign(&mut self, rhs: u64)

Performs the *= operation. Read more
source§

impl MulAssign for EDs

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl Ord for EDs

source§

fn cmp(&self, other: &EDs) -> 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 EDs

source§

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

Tests for self and other values to be equal, and is used by ==.
1.6.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 EDs

source§

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

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

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

Tests less than (for self and other) and is used by the < operator. Read more
1.6.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.6.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.6.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 Storable for EDs

source§

const BOUND: Bound = Bound::Unbounded

The size bounds of the type.
source§

fn to_bytes(&self) -> Cow<'_, [u8]>

Converts an element into bytes. Read more
source§

fn from_bytes(bytes: Cow<'_, [u8]>) -> Self

Converts bytes into an element.
source§

fn to_bytes_checked(&self) -> Cow<'_, [u8]>

Like to_bytes, but includes additional checks to ensure the element’s serialized bytes are within the element’s bounds.
source§

impl Sub<&EDs> for EDs

source§

type Output = EDs

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &EDs) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<EDs> for &EDs

source§

type Output = EDs

The resulting type after applying the - operator.
source§

fn sub(self, rhs: EDs) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for &EDs

source§

type Output = EDs

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for EDs

source§

type Output = EDs

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<&EDs> for EDs

source§

fn sub_assign(&mut self, rhs: &EDs)

Performs the -= operation. Read more
source§

impl SubAssign for EDs

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl Eq for EDs

source§

impl StructuralPartialEq for EDs

Auto Trait Implementations§

§

impl Freeze for EDs

§

impl RefUnwindSafe for EDs

§

impl Send for EDs

§

impl Sync for EDs

§

impl Unpin for EDs

§

impl UnwindSafe for EDs

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> Same for T

source§

type Output = T

Should always be Self
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§

default 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.
source§

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