pub struct EDs {
pub val: BigUint,
pub decimals: u8,
}Expand description
Fixed-point decimals with primitive math (+-*/) implemented correctly
Fields§
§val: BigUint§decimals: u8Implementations§
Source§impl EDs
impl EDs
pub fn new(val: BigUint, decimals: u8) -> Self
pub fn base(decimals: u8) -> &'static BigUint
pub fn zero(decimals: u8) -> Self
pub fn one(decimals: u8) -> Self
pub fn f0_1(decimals: u8) -> Self
pub fn f0_2(decimals: u8) -> Self
pub fn f0_25(decimals: u8) -> Self
pub fn f0_3(decimals: u8) -> Self
pub fn f0_33(decimals: u8) -> Self
pub fn f0_4(decimals: u8) -> Self
pub fn f0_5(decimals: u8) -> Self
pub fn f0_6(decimals: u8) -> Self
pub fn f0_67(decimals: u8) -> Self
pub fn f0_7(decimals: u8) -> Self
pub fn f0_75(decimals: u8) -> Self
pub fn f0_8(decimals: u8) -> Self
pub fn f0_9(decimals: u8) -> Self
pub fn two(decimals: u8) -> Self
pub fn to_const<const D: usize>(self) -> ECs<D>
pub fn to_decimals(self, new_decimals: u8) -> EDs
pub fn sqrt(&self) -> Self
Trait Implementations§
Source§impl AddAssign for EDs
impl AddAssign for EDs
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl AddAssign<&EDs> for EDs
impl AddAssign<&EDs> for EDs
Source§fn add_assign(&mut self, rhs: &EDs)
fn add_assign(&mut self, rhs: &EDs)
Performs the
+= operation. Read moreSource§impl CandidType for EDs
impl CandidType for EDs
Source§impl<'de> Deserialize<'de> for EDs
impl<'de> Deserialize<'de> for EDs
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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 DivAssign for EDs
impl DivAssign for EDs
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/= operation. Read moreSource§impl DivAssign<&EDs> for EDs
impl DivAssign<&EDs> for EDs
Source§fn div_assign(&mut self, rhs: &EDs)
fn div_assign(&mut self, rhs: &EDs)
Performs the
/= operation. Read moreSource§impl DivAssign<u64> for EDs
impl DivAssign<u64> for EDs
Source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
Performs the
/= operation. Read moreimpl Eq for EDs
Source§impl MulAssign for EDs
impl MulAssign for EDs
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl MulAssign<&EDs> for EDs
impl MulAssign<&EDs> for EDs
Source§fn mul_assign(&mut self, rhs: &EDs)
fn mul_assign(&mut self, rhs: &EDs)
Performs the
*= operation. Read moreSource§impl MulAssign<u64> for EDs
impl MulAssign<u64> for EDs
Source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
Performs the
*= operation. Read moreSource§impl Ord for EDs
impl Ord for EDs
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for EDs
impl PartialOrd for EDs
Source§impl Storable for EDs
impl Storable for EDs
Source§fn from_bytes(bytes: Cow<'_, [u8]>) -> Self
fn from_bytes(bytes: Cow<'_, [u8]>) -> Self
Converts bytes into an element.
Source§fn to_bytes_checked(&self) -> Cow<'_, [u8]>
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.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 UnsafeUnpin for EDs
impl UnwindSafe for EDs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more