Struct ic_e8s::c::ECs

source ·
pub struct ECs<const DECIMALS: usize> {
    pub val: BigUint,
}
Expand description

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

Fields§

§val: BigUint

Implementations§

source§

impl<const D: usize> ECs<D>

source

pub fn new(val: BigUint) -> Self

source

pub fn base() -> &'static BigUint

source

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

source

pub fn zero() -> Self

source

pub fn one() -> Self

source

pub fn f0_1() -> Self

source

pub fn f0_2() -> Self

source

pub fn f0_25() -> Self

source

pub fn f0_3() -> Self

source

pub fn f0_33() -> Self

source

pub fn f0_4() -> Self

source

pub fn f0_5() -> Self

source

pub fn f0_6() -> Self

source

pub fn f0_67() -> Self

source

pub fn f0_7() -> Self

source

pub fn f0_75() -> Self

source

pub fn f0_8() -> Self

source

pub fn f0_9() -> Self

source

pub fn two() -> Self

source

pub fn sqrt(&self) -> Self

source

pub fn to_dynamic(self) -> EDs

source

pub fn to_decimals<const D1: usize>(self) -> ECs<D1>

Trait Implementations§

source§

impl<const D: usize> Add<&ECs<D>> for ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &ECs<D>) -> Self::Output

Performs the + operation. Read more
source§

impl<const D: usize> Add<ECs<D>> for &ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<const D: usize> Add for &ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<const D: usize> Add for ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<const D: usize> AddAssign<&ECs<D>> for ECs<D>

source§

fn add_assign(&mut self, rhs: &ECs<D>)

Performs the += operation. Read more
source§

impl<const D: usize> AddAssign for ECs<D>

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl<const D: usize> CandidType for ECs<D>

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<const DECIMALS: usize> Clone for ECs<DECIMALS>

source§

fn clone(&self) -> ECs<DECIMALS>

Returns a copy 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<const DECIMALS: usize> Debug for ECs<DECIMALS>

source§

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

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

impl<const DECIMALS: usize> Default for ECs<DECIMALS>

source§

fn default() -> ECs<DECIMALS>

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

impl<'de, const C: usize> Deserialize<'de> for ECs<C>

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<const D: usize> Display for ECs<D>

source§

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

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

impl<const D: usize> Div<&ECs<D>> for ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &ECs<D>) -> Self::Output

Performs the / operation. Read more
source§

impl<const D: usize> Div<ECs<D>> for &ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<const D: usize> Div for &ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<const D: usize> Div for ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<const D: usize> DivAssign<&ECs<D>> for ECs<D>

source§

fn div_assign(&mut self, rhs: &ECs<D>)

Performs the /= operation. Read more
source§

impl<const D: usize> DivAssign for ECs<D>

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl<const D: usize> From<u128> for ECs<D>

source§

fn from(value: u128) -> Self

Converts to this type from the input type.
source§

impl<const D: usize> From<u64> for ECs<D>

source§

fn from(value: u64) -> Self

Converts to this type from the input type.
source§

impl<const DECIMALS: usize> Hash for ECs<DECIMALS>

source§

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

Feeds this value into the given Hasher. Read more
1.3.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<const D: usize> Mul<&ECs<D>> for ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &ECs<D>) -> Self::Output

Performs the * operation. Read more
source§

impl<const D: usize> Mul<ECs<D>> for &ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<const D: usize> Mul for &ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<const D: usize> Mul for ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<const D: usize> MulAssign<&ECs<D>> for ECs<D>

source§

fn mul_assign(&mut self, rhs: &ECs<D>)

Performs the *= operation. Read more
source§

impl<const D: usize> MulAssign for ECs<D>

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl<const DECIMALS: usize> Ord for ECs<DECIMALS>

source§

fn cmp(&self, other: &ECs<DECIMALS>) -> 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 + PartialOrd,

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

impl<const DECIMALS: usize> PartialEq for ECs<DECIMALS>

source§

fn eq(&self, other: &ECs<DECIMALS>) -> 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<const DECIMALS: usize> PartialOrd for ECs<DECIMALS>

source§

fn partial_cmp(&self, other: &ECs<DECIMALS>) -> 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<const D: usize> Storable for ECs<D>

source§

const BOUND: Bound = _

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<const D: usize> Sub<&ECs<D>> for ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &ECs<D>) -> Self::Output

Performs the - operation. Read more
source§

impl<const D: usize> Sub<ECs<D>> for &ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<const D: usize> Sub for &ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<const D: usize> Sub for ECs<D>

source§

type Output = ECs<D>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<const D: usize> SubAssign<&ECs<D>> for ECs<D>

source§

fn sub_assign(&mut self, rhs: &ECs<D>)

Performs the -= operation. Read more
source§

impl<const D: usize> SubAssign for ECs<D>

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl<const DECIMALS: usize> Eq for ECs<DECIMALS>

source§

impl<const DECIMALS: usize> StructuralPartialEq for ECs<DECIMALS>

Auto Trait Implementations§

§

impl<const DECIMALS: usize> Freeze for ECs<DECIMALS>

§

impl<const DECIMALS: usize> RefUnwindSafe for ECs<DECIMALS>

§

impl<const DECIMALS: usize> Send for ECs<DECIMALS>

§

impl<const DECIMALS: usize> Sync for ECs<DECIMALS>

§

impl<const DECIMALS: usize> Unpin for ECs<DECIMALS>

§

impl<const DECIMALS: usize> UnwindSafe for ECs<DECIMALS>

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>,