Struct dharitri_wasm::types::BigInt

source ·
pub struct BigInt<M: ManagedTypeApi> { /* private fields */ }

Implementations§

source§

impl<M: ManagedTypeApi> BigInt<M>

More conversions here.

source

pub fn zero(api: M) -> Self

source

pub fn from_i64(api: M, value: i64) -> Self

source

pub fn from_i32(api: M, value: i32) -> Self

source

pub fn to_i64(&self) -> Option<i64>

source

pub fn from_signed_bytes_be(api: M, bytes: &[u8]) -> Self

source

pub fn to_signed_bytes_be(&self) -> BoxedBytes

source

pub fn from_signed_bytes_be_buffer(managed_buffer: &ManagedBuffer<M>) -> Self

source

pub fn to_signed_bytes_be_buffer(&self) -> ManagedBuffer<M>

source§

impl<M: ManagedTypeApi> BigInt<M>

source

pub fn from_biguint(sign: Sign, unsigned: BigUint<M>) -> Self

source

pub fn sign(&self) -> Sign

Returns the sign of the BigInt as a Sign.

source

pub fn magnitude(&self) -> BigUint<M>

Returns the magnitude of the BigInt as a BigUint.

source

pub fn to_parts(self) -> (Sign, BigUint<M>)

Convert this BigInt into its Sign and BigUint magnitude, the reverse of BigInt::from_biguint.

source

pub fn into_biguint(self) -> Option<BigUint<M>>

Converts this BigInt into a BigUint, if it’s not negative.

source§

impl<M: ManagedTypeApi> BigInt<M>

source

pub fn pow(&self, exp: u32) -> Self

Trait Implementations§

source§

impl<'a, 'b, M: ManagedTypeApi> Add<&'b BigInt<M>> for &'a BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the + operator.
source§

fn add(self, other: &BigInt<M>) -> BigInt<M>

Performs the + operation. Read more
source§

impl<M: ManagedTypeApi> Add for BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the + operator.
source§

fn add(self, other: BigInt<M>) -> BigInt<M>

Performs the + operation. Read more
source§

impl<M: ManagedTypeApi> AddAssign<&BigInt<M>> for BigInt<M>

source§

fn add_assign(&mut self, other: &BigInt<M>)

Performs the += operation. Read more
source§

impl<M: ManagedTypeApi> AddAssign for BigInt<M>

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl<M: ManagedTypeApi> Clone for BigInt<M>

source§

fn clone(&self) -> Self

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<M: Debug + ManagedTypeApi> Debug for BigInt<M>

source§

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

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

impl<'a, 'b, M: ManagedTypeApi> Div<&'b BigInt<M>> for &'a BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the / operator.
source§

fn div(self, other: &BigInt<M>) -> BigInt<M>

Performs the / operation. Read more
source§

impl<M: ManagedTypeApi> Div for BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the / operator.
source§

fn div(self, other: BigInt<M>) -> BigInt<M>

Performs the / operation. Read more
source§

impl<M: ManagedTypeApi> DivAssign<&BigInt<M>> for BigInt<M>

source§

fn div_assign(&mut self, other: &BigInt<M>)

Performs the /= operation. Read more
source§

impl<M: ManagedTypeApi> DivAssign for BigInt<M>

source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
source§

impl<M: ManagedTypeApi> From<&ManagedBuffer<M>> for BigInt<M>

source§

fn from(item: &ManagedBuffer<M>) -> Self

Converts to this type from the input type.
source§

impl<M: ManagedTypeApi> From<ManagedBuffer<M>> for BigInt<M>

source§

fn from(item: ManagedBuffer<M>) -> Self

Converts to this type from the input type.
source§

impl<M: ManagedTypeApi> ManagedDefault<M> for BigInt<M>

source§

fn managed_default(api: M) -> Self

source§

impl<M, U> ManagedFrom<M, U> for BigInt<M>
where M: ManagedTypeApi, U: Into<i64>,

source§

fn managed_from(api: M, value: U) -> Self

source§

impl<M: ManagedTypeApi> ManagedType<M> for BigInt<M>

source§

fn type_manager(&self) -> M

source§

impl<M: ManagedTypeApi> ManagedVecItem<M> for BigInt<M>

source§

const PAYLOAD_SIZE: usize = 4usize

Size of the data stored in the underlying ManagedBuffer.
source§

const SKIPS_RESERIALIZATION: bool = false

If true, then the encoding of the item is identical to the payload, and no further conversion is necessary (the underlying buffer can be used as-is during serialization). False for all managed types, but true for basic types (like u32).
source§

fn from_byte_reader<Reader: FnMut(&mut [u8])>(api: M, reader: Reader) -> Self

source§

fn to_byte_writer<R, Writer: FnMut(&[u8]) -> R>(&self, writer: Writer) -> R

source§

impl<'a, 'b, M: ManagedTypeApi> Mul<&'b BigInt<M>> for &'a BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the * operator.
source§

fn mul(self, other: &BigInt<M>) -> BigInt<M>

Performs the * operation. Read more
source§

impl<M: ManagedTypeApi> Mul for BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the * operator.
source§

fn mul(self, other: BigInt<M>) -> BigInt<M>

Performs the * operation. Read more
source§

impl<M: ManagedTypeApi> MulAssign<&BigInt<M>> for BigInt<M>

source§

fn mul_assign(&mut self, other: &BigInt<M>)

Performs the *= operation. Read more
source§

impl<M: ManagedTypeApi> MulAssign for BigInt<M>

source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
source§

impl<M: ManagedTypeApi> Neg for BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<M: ManagedTypeApi> NestedDecode for BigInt<M>

source§

fn dep_decode<I: NestedDecodeInput>(input: &mut I) -> Result<Self, DecodeError>

Attempt to deserialise the value from input, using the format of an object nested inside another structure. In case of success returns the deserialized value and the number of bytes consumed during the operation.
source§

fn dep_decode_or_exit<I: NestedDecodeInput, ExitCtx: Clone>( input: &mut I, c: ExitCtx, exit: fn(_: ExitCtx, _: DecodeError) -> ! ) -> Self

Version of top_decode that exits quickly in case of error. Its purpose is to create smaller implementations in cases where the application is supposed to exit directly on decode error.
source§

impl<M: ManagedTypeApi> NestedEncode for BigInt<M>

source§

fn dep_encode<O: NestedEncodeOutput>( &self, dest: &mut O ) -> Result<(), EncodeError>

NestedEncode to output, using the format of an object nested inside another structure. Does not provide compact version.
source§

fn dep_encode_or_exit<O, ExitCtx>( &self, dest: &mut O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )
where O: NestedEncodeOutput, ExitCtx: Clone,

Version of top_decode that exits quickly in case of error. Its purpose is to create smaller implementations in cases where the application is supposed to exit directly on decode error.
source§

impl<M: ManagedTypeApi> Ord for BigInt<M>

source§

fn cmp(&self, other: &Self) -> 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<M: ManagedTypeApi> PartialEq<i64> for BigInt<M>

source§

fn eq(&self, other: &i64) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<M: ManagedTypeApi> PartialEq for BigInt<M>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<M: ManagedTypeApi> PartialOrd<i64> for BigInt<M>

source§

fn partial_cmp(&self, other: &i64) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<M: ManagedTypeApi> PartialOrd for BigInt<M>

source§

fn partial_cmp(&self, other: &Self) -> 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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b, M: ManagedTypeApi> Rem<&'b BigInt<M>> for &'a BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the % operator.
source§

fn rem(self, other: &BigInt<M>) -> BigInt<M>

Performs the % operation. Read more
source§

impl<M: ManagedTypeApi> Rem for BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the % operator.
source§

fn rem(self, other: BigInt<M>) -> BigInt<M>

Performs the % operation. Read more
source§

impl<M: ManagedTypeApi> RemAssign<&BigInt<M>> for BigInt<M>

source§

fn rem_assign(&mut self, other: &BigInt<M>)

Performs the %= operation. Read more
source§

impl<M: ManagedTypeApi> RemAssign for BigInt<M>

source§

fn rem_assign(&mut self, other: Self)

Performs the %= operation. Read more
source§

impl<'a, 'b, M: ManagedTypeApi> Sub<&'b BigInt<M>> for &'a BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the - operator.
source§

fn sub(self, other: &BigInt<M>) -> BigInt<M>

Performs the - operation. Read more
source§

impl<M: ManagedTypeApi> Sub for BigInt<M>

§

type Output = BigInt<M>

The resulting type after applying the - operator.
source§

fn sub(self, other: BigInt<M>) -> BigInt<M>

Performs the - operation. Read more
source§

impl<M: ManagedTypeApi> SubAssign<&BigInt<M>> for BigInt<M>

source§

fn sub_assign(&mut self, other: &BigInt<M>)

Performs the -= operation. Read more
source§

impl<M: ManagedTypeApi> SubAssign for BigInt<M>

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl<M: ManagedTypeApi> TopDecode for BigInt<M>

source§

fn top_decode<I: TopDecodeInput>(input: I) -> Result<Self, DecodeError>

Attempt to deserialize the value from input.
source§

fn top_decode_or_exit<I, ExitCtx>( input: I, c: ExitCtx, exit: fn(_: ExitCtx, _: DecodeError) -> ! ) -> Self
where I: TopDecodeInput, ExitCtx: Clone,

Version of top_decode that exits quickly in case of error. Its purpose is to create smaller implementations in cases where the application is supposed to exit directly on decode error.
source§

impl<M: ManagedTypeApi> TopEncode for BigInt<M>

source§

fn top_encode<O: TopEncodeOutput>(&self, output: O) -> Result<(), EncodeError>

Attempt to serialize the value to ouput.
source§

fn top_encode_or_exit<O, ExitCtx>( &self, output: O, c: ExitCtx, exit: fn(_: ExitCtx, _: EncodeError) -> ! )
where O: TopEncodeOutput, ExitCtx: Clone,

Version of top_decode that exits quickly in case of error. Its purpose is to create smaller bytecode implementations in cases where the application is supposed to exit directly on decode error.
source§

impl<M: ManagedTypeApi> TryStaticCast for BigInt<M>

source§

fn type_eq<U>() -> bool
where U: TryStaticCast,

source§

fn try_cast<U>(self) -> Option<U>
where U: TryStaticCast,

source§

fn try_cast_ref<U>(&self) -> Option<&U>
where U: TryStaticCast,

source§

impl<M: ManagedTypeApi> TypeAbi for BigInt<M>

source§

fn type_name() -> String

source§

fn provide_type_descriptions<TDC: TypeDescriptionContainer>( accumulator: &mut TDC )

A type can provide more than its own description. For instance, a struct can also provide the descriptions of the type of its fields. TypeAbi doesn’t care for the exact accumulator type, which is abstracted by the TypeDescriptionContainer trait.
source§

impl<M: ManagedTypeApi> Eq for BigInt<M>

Auto Trait Implementations§

§

impl<M> RefUnwindSafe for BigInt<M>
where M: RefUnwindSafe,

§

impl<M> Send for BigInt<M>
where M: Send,

§

impl<M> Sync for BigInt<M>
where M: Sync,

§

impl<M> Unpin for BigInt<M>
where M: Unpin,

§

impl<M> UnwindSafe for BigInt<M>
where M: UnwindSafe,

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<M, T> AsManagedRef<M, T> for T
where M: ManagedTypeApi, T: ManagedType<M>,

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> ContractCallArg for T
where T: TopEncode,

source§

fn push_dyn_arg<O>(&self, output: &mut O)
where O: DynArgOutput,

source§

impl<T> DynArg for T
where T: TopEncode + TopDecode,

source§

fn dyn_load<I>(loader: &mut I, arg_id: ArgId) -> T
where I: DynArgInput,

source§

impl<T> EndpointResult for T
where T: TopEncode,

§

type DecodeAs = T

Indicates how the result of the endpoint can be interpreted when called via proxy. Self for most types.
source§

fn finish<FA>(&self, api: FA)
where FA: ManagedTypeApi + EndpointFinishApi + Clone + 'static,

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<M, F> ManagedFrom<M, F> for F
where M: ManagedTypeApi,

source§

fn managed_from(_: M, t: F) -> F

source§

impl<M, F, T> ManagedInto<M, T> for F
where T: ManagedFrom<M, F>, M: ManagedTypeApi,

source§

fn managed_into(self, api: M) -> T

source§

impl<T> ToOwned for T
where T: Clone,

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.