pub struct U256(/* private fields */);Expand description
IcyDB-owned fixed-width unsigned 256-bit scalar.
Runtime values are inline and allocation-free. Human-readable Serde uses decimal text; binary Serde uses an exact 32-byte big-endian byte string. Persistence and index encodings are owned separately by IcyDB.
Implementations§
Source§impl U256
impl U256
Sourcepub const fn from_words(high: u128, low: u128) -> U256
pub const fn from_words(high: u128, low: u128) -> U256
Build from two 128-bit words in numeric high/low order.
Sourcepub const fn into_words(self) -> (u128, u128)
pub const fn into_words(self) -> (u128, u128)
Split into two 128-bit words in numeric high/low order.
Sourcepub fn from_be_bytes(bytes: [u8; 32]) -> U256
pub fn from_be_bytes(bytes: [u8; 32]) -> U256
Build from exactly 32 unsigned big-endian bytes.
Sourcepub fn to_be_bytes(self) -> [u8; 32]
pub fn to_be_bytes(self) -> [u8; 32]
Return exactly 32 unsigned big-endian bytes.
Sourcepub fn checked_add(self, rhs: U256) -> Option<U256>
pub fn checked_add(self, rhs: U256) -> Option<U256>
Add two values, returning None on unsigned 256-bit overflow.
Sourcepub fn checked_sub(self, rhs: U256) -> Option<U256>
pub fn checked_sub(self, rhs: U256) -> Option<U256>
Subtract two values, returning None on unsigned 256-bit underflow.
Sourcepub fn checked_mul(self, rhs: U256) -> Option<U256>
pub fn checked_mul(self, rhs: U256) -> Option<U256>
Multiply two values, returning None on unsigned 256-bit overflow.
Sourcepub fn checked_div(self, rhs: U256) -> Option<U256>
pub fn checked_div(self, rhs: U256) -> Option<U256>
Divide two values, returning None when the divisor is zero.
Sourcepub fn checked_rem(self, rhs: U256) -> Option<U256>
pub fn checked_rem(self, rhs: U256) -> Option<U256>
Return the remainder, or None when the divisor is zero.
Trait Implementations§
impl Copy for U256
Source§impl<'de> Deserialize<'de> for U256
impl<'de> Deserialize<'de> for U256
Source§fn deserialize<D>(
deserializer: D,
) -> Result<U256, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<U256, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for U256
Source§impl NormalizeAuto for U256
impl NormalizeAuto for U256
fn normalize_self(&mut self, _ctx: &mut dyn VisitorContext)
Source§impl NormalizeCustom for U256
impl NormalizeCustom for U256
fn normalize_custom(&mut self, _ctx: &mut dyn VisitorContext)
Source§impl NumericValue for U256
impl NumericValue for U256
Source§impl Ord for U256
impl Ord for U256
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for U256
impl PartialOrd for U256
Source§impl Serialize for U256
impl Serialize for U256
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for U256
Source§impl ValidateAuto for U256
impl ValidateAuto for U256
fn validate_self(&self, _ctx: &mut dyn VisitorContext)
Source§impl ValidateCustom for U256
impl ValidateCustom for U256
fn validate_custom(&self, _ctx: &mut dyn VisitorContext)
Source§impl Visitable for U256
impl Visitable for U256
Source§fn type_identity(&self) -> &'static str
fn type_identity(&self) -> &'static str
fn drive(&self, _: &mut dyn VisitorCore)
fn drive_mut(&mut self, _: &mut dyn VisitorMutCore)
Source§impl Wire for U256
impl Wire for U256
Source§fn native_schema(_: &mut SchemaContext) -> Result<Value, GenerationError>
fn native_schema(_: &mut SchemaContext) -> Result<Value, GenerationError>
Auto Trait Implementations§
impl Freeze for U256
impl RefUnwindSafe for U256
impl Send for U256
impl Sync for U256
impl Unpin for U256
impl UnsafeUnpin for U256
impl UnwindSafe for U256
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.