Trait dharitri_wasm::api::BigUintApi
source · pub trait BigUintApi: Sized + From<u64> + From<u32> + From<usize> + Clone + Default + Add<Output = Self> + AddAssign + Sub<Output = Self> + SubAssign + Mul<Output = Self> + MulAssign + Div<Output = Self> + DivAssign + Rem<Output = Self> + RemAssign + BitAnd<Output = Self> + BitAndAssign + BitOr<Output = Self> + BitOrAssign + BitXor<Output = Self> + BitXorAssign + Shr<usize, Output = Self> + ShrAssign<usize> + Shl<usize, Output = Self> + ShlAssign<usize> + PartialEq<Self> + Eq + PartialOrd<Self> + Ord + PartialEq<u64> + PartialOrd<u64> + NestedEncode + TopEncode + NestedDecode + TopDecode + TypeAbi {
// Required methods
fn byte_length(&self) -> i32;
fn copy_to_slice_big_endian(&self, slice: &mut [u8]) -> i32;
fn copy_to_array_big_endian_pad_right(&self, target: &mut [u8; 32]);
fn to_bytes_be(&self) -> Vec<u8>;
fn to_bytes_be_pad_right(&self, nr_bytes: usize) -> Option<Vec<u8>>;
fn from_bytes_be(bytes: &[u8]) -> Self;
// Provided method
fn zero() -> Self { ... }
}Expand description
Definition of the BigUint type required by the API. The API doesn’t care about the actual BigInt implementation. The Arwen VM provides an implementation directly in the protocol. For debugging we use a different implementation, based on Rust’s BigInt.
Since most values in smart contracts will not be signed, as well as for safety, most of the functionality if provided for unsigned integers.
Required Methods§
fn byte_length(&self) -> i32
fn copy_to_slice_big_endian(&self, slice: &mut [u8]) -> i32
fn copy_to_array_big_endian_pad_right(&self, target: &mut [u8; 32])
fn to_bytes_be(&self) -> Vec<u8>
fn to_bytes_be_pad_right(&self, nr_bytes: usize) -> Option<Vec<u8>>
fn from_bytes_be(bytes: &[u8]) -> Self
Provided Methods§
Object Safety§
This trait is not object safe.