pub struct Constant(_);
Expand description

Ergo constant(evaluated) values

Implementations

Returns the debug representation of the type of the constant

Returns the debug representation of the value of the constant

Decode from Base16-encoded ErgoTree serialized value

Encode as Base16-encoded ErgoTree serialized value or return an error if serialization failed

Returns serialized bytes or fails with error if Constant cannot be serialized

Create from i32 value

Extract i32 value, returning error if wrong type

Create from i64

Extract i64 value, returning error if wrong type

Create BigInt constant from byte array (signed bytes bit-endian)

Create from byte array

Extract byte array, returning error if wrong type

Create Coll[Int] from integer array

Extract Coll[Int] as integer array

Create Coll[Long] from string array

Extract Coll[Long] as string array

Extract Coll[Coll[Byte]] as array of byte arrays

Create Coll[Coll[Byte]] from array byte array

Parse raw EcPoint value from bytes and make ProveDlog constant

Parse raw EcPoint value from bytes and make GroupElement constant

Create (Coll[Byte], Coll[Byte]) tuple Constant

Extract (Coll[Byte], Coll[Byte]) tuple from Constant as array of Uint8Array

Create (Int, Int) tuple Constant

Create (Long, Long) tuple Constant

Extract (Long, Long) tuple from Constant as array of strings

Create from ErgoBox value

Extract ErgoBox value, returning error if wrong type

Create Constant with Unit value

Returns true if constant value is Unit

Create a Constant from JS value JS types are converted to the following Ergo types: Number -> Int, String -> Long, BigInt -> BigInt, use array_as_tuple() to encode Ergo tuples

Extract JS value from Constant Ergo types are converted to the following JS types: Byte -> Number, Short -> Number, Int -> Number, Long -> String, BigInt -> BigInt, Ergo tuples are encoded as arrays

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more
Recover a Self from Self::Abi. Read more
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
Convert self into Self::Abi so that it can be sent across the wasm ABI boundary. Read more
Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi. Read more
Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
The wasm ABI type references to Self are recovered from.
The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more
Recover a Self::Anchor from Self::Abi. Read more
Same as RefFromWasmAbi::Abi
Same as RefFromWasmAbi::Anchor
Same as RefFromWasmAbi::ref_from_abi

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Converts self into T using Into<T>. Read more
Compare self to key and return true if they are equal.
Causes self to use its Binary implementation when Debug-formatted.
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted.
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
Same as IntoWasmAbi::Abi
Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err. Read more
Should always be Self
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
Extract value of the given type from any type (e.g. [‘Constant’], [super::value::Value]) on which [TryExtractFrom] is implemented Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.