pub struct Uint256(pub U256);
Tuple Fields
0: U256
Implementations
sourceimpl Uint256
impl Uint256
sourcepub fn sqrt(self) -> StdResult<Self>
pub fn sqrt(self) -> StdResult<Self>
U256 sqrt ported from here: https://ethereum.stackexchange.com/a/87713/12112
sourcepub fn multiply_ratio<A: Into<Self>, B: Into<Self>>(
self,
nom: A,
denom: B
) -> StdResult<Uint256>
pub fn multiply_ratio<A: Into<Self>, B: Into<Self>>(
self,
nom: A,
denom: B
) -> StdResult<Uint256>
returns self * nom / denom
pub fn decimal_mul(self, b: Decimal256) -> StdResult<Uint256>
pub fn decimal_div(self, b: Decimal256) -> StdResult<Uint256>
pub fn checked_pow(self, rhs: Self) -> StdResult<Self>
sourcepub fn clamp_u128(self) -> StdResult<u128>
pub fn clamp_u128(self) -> StdResult<u128>
Return the first 128 bits or an error if the current number would overflow a u128.
pub const MAX: Self = Self(primitive_types::U256::MAX)
pub const fn zero() -> Self
pub fn is_zero(&self) -> bool
pub fn checked_div(self, rhs: Self) -> StdResult<Self>
pub fn checked_mul(self, rhs: Self) -> StdResult<Self>
pub fn checked_sub(self, rhs: Self) -> StdResult<Self>
pub fn checked_add(self, rhs: Self) -> StdResult<Self>
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Uint256
impl<'de> Deserialize<'de> for Uint256
sourcefn deserialize<D>(deserializer: D) -> Result<Uint256, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Uint256, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Decimal256> for Uint256
impl From<Decimal256> for Uint256
sourcefn from(value: Decimal256) -> Self
fn from(value: Decimal256) -> Self
Converts to this type from the input type.
sourceimpl JsonSchema for Uint256
impl JsonSchema for Uint256
sourcefn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
sourcefn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
sourcefn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the $ref
keyword. Read more
sourceimpl Ord for Uint256
impl Ord for Uint256
sourceimpl PartialOrd<Uint256> for Uint256
impl PartialOrd<Uint256> for Uint256
sourcefn partial_cmp(&self, other: &Uint256) -> Option<Ordering>
fn partial_cmp(&self, other: &Uint256) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl TryFrom<Uint256> for Decimal256
impl TryFrom<Uint256> for Decimal256
impl Copy for Uint256
impl Eq for Uint256
impl StructuralEq for Uint256
impl StructuralPartialEq for Uint256
Auto Trait Implementations
impl RefUnwindSafe for Uint256
impl Send for Uint256
impl Sync for Uint256
impl Unpin for Uint256
impl UnwindSafe for Uint256
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more