Struct ergo_lib_wasm::ast::Constant
source · [−]pub struct Constant(_);
Expand description
Ergo constant(evaluated) values
Implementations
sourceimpl Constant
impl Constant
sourcepub fn decode_from_base16(base16_bytes_str: String) -> Result<Constant, JsValue>
pub fn decode_from_base16(base16_bytes_str: String) -> Result<Constant, JsValue>
Decode from Base16-encoded ErgoTree serialized value
sourcepub fn encode_to_base16(&self) -> Result<String, JsValue>
pub fn encode_to_base16(&self) -> Result<String, JsValue>
Encode as Base16-encoded ErgoTree serialized value or return an error if serialization failed
sourcepub fn sigma_serialize_bytes(&self) -> Result<Vec<u8>, JsValue>
pub fn sigma_serialize_bytes(&self) -> Result<Vec<u8>, JsValue>
Returns serialized bytes or fails with error if Constant cannot be serialized
sourcepub fn from_bigint_signed_bytes_be(num: &[u8]) -> Result<Constant, JsValue>
pub fn from_bigint_signed_bytes_be(num: &[u8]) -> Result<Constant, JsValue>
Create BigInt constant from byte array (signed bytes bit-endian)
sourcepub fn from_byte_array(v: &[u8]) -> Constant
pub fn from_byte_array(v: &[u8]) -> Constant
Create from byte array
sourcepub fn to_byte_array(&self) -> Result<Uint8Array, JsValue>
pub fn to_byte_array(&self) -> Result<Uint8Array, JsValue>
Extract byte array, returning error if wrong type
sourcepub fn from_i32_array(arr: Box<[i32]>) -> Result<Constant, JsValue>
pub fn from_i32_array(arr: Box<[i32]>) -> Result<Constant, JsValue>
Create Coll[Int]
from integer array
sourcepub fn from_i64_str_array(arr: Box<[JsValue]>) -> Result<Constant, JsValue>
pub fn from_i64_str_array(arr: Box<[JsValue]>) -> Result<Constant, JsValue>
Create Coll[Long]
from string array
sourcepub fn to_i64_str_array(&self) -> Result<Box<[JsValue]>, JsValue>
pub fn to_i64_str_array(&self) -> Result<Box<[JsValue]>, JsValue>
Extract Coll[Long]
as string array
sourcepub fn to_coll_coll_byte(&self) -> Result<Vec<Uint8Array>, JsValue>
pub fn to_coll_coll_byte(&self) -> Result<Vec<Uint8Array>, JsValue>
Extract Coll[Coll[Byte]]
as array of byte arrays
sourcepub fn from_coll_coll_byte(arr: Vec<Uint8Array>) -> Constant
pub fn from_coll_coll_byte(arr: Vec<Uint8Array>) -> Constant
Create Coll[Coll[Byte]]
from array byte array
sourcepub fn from_ecpoint_bytes(bytes: &[u8]) -> Result<Constant, JsValue>
pub fn from_ecpoint_bytes(bytes: &[u8]) -> Result<Constant, JsValue>
Parse raw EcPoint
value from bytes and make ProveDlog
constant
sourcepub fn from_ecpoint_bytes_group_element(
bytes: &[u8]
) -> Result<Constant, JsValue>
pub fn from_ecpoint_bytes_group_element(
bytes: &[u8]
) -> Result<Constant, JsValue>
Parse raw EcPoint
value from bytes and make GroupElement
constant
sourcepub fn from_tuple_coll_bytes(bytes1: &[u8], bytes2: &[u8]) -> Constant
pub fn from_tuple_coll_bytes(bytes1: &[u8], bytes2: &[u8]) -> Constant
Create (Coll[Byte], Coll[Byte])
tuple Constant
sourcepub fn to_tuple_coll_bytes(&self) -> Result<Vec<Uint8Array>, JsValue>
pub fn to_tuple_coll_bytes(&self) -> Result<Vec<Uint8Array>, JsValue>
Extract (Coll[Byte], Coll[Byte])
tuple from Constant as array of Uint8Array
sourcepub fn from_tuple_i64(l1: &I64, l2: &I64) -> Constant
pub fn from_tuple_i64(l1: &I64, l2: &I64) -> Constant
Create (Long, Long)
tuple Constant
sourcepub fn to_tuple_i64(&self) -> Result<Vec<JsValue>, JsValue>
pub fn to_tuple_i64(&self) -> Result<Vec<JsValue>, JsValue>
Extract (Long, Long)
tuple from Constant as array of strings
sourcepub fn from_ergo_box(v: &ErgoBox) -> Constant
pub fn from_ergo_box(v: &ErgoBox) -> Constant
Create from ErgoBox value
sourcepub fn to_ergo_box(&self) -> Result<ErgoBox, JsValue>
pub fn to_ergo_box(&self) -> Result<ErgoBox, JsValue>
Extract ErgoBox value, returning error if wrong type
Trait Implementations
sourceimpl FromWasmAbi for Constant
impl FromWasmAbi for Constant
sourceimpl IntoWasmAbi for Constant
impl IntoWasmAbi for Constant
sourceimpl OptionFromWasmAbi for Constant
impl OptionFromWasmAbi for Constant
sourceimpl OptionIntoWasmAbi for Constant
impl OptionIntoWasmAbi for Constant
sourceimpl RefFromWasmAbi for Constant
impl RefFromWasmAbi for Constant
type Anchor = Ref<'static, Constant>
type Anchor = Ref<'static, Constant>
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
sourceunsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
Recover a Self::Anchor
from Self::Abi
. Read more
sourceimpl RefMutFromWasmAbi for Constant
impl RefMutFromWasmAbi for Constant
impl Eq for Constant
impl StructuralEq for Constant
impl StructuralPartialEq for Constant
Auto Trait Implementations
impl RefUnwindSafe for Constant
impl !Send for Constant
impl !Sync for Constant
impl Unpin for Constant
impl UnwindSafe for Constant
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<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Causes self
to use its Binary
implementation when Debug
-formatted.
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
Causes self
to use its Octal
implementation when Debug
-formatted.
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
Pipes by value. This is generally the method you want to use. Read more
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
Borrows self
and passes that borrow into the pipe function. Read more
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
Mutably borrows self
and passes that borrow into the pipe function. Read more
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.borrow()
into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.as_ref()
into the pipe function.
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.deref()
into the pipe function.
sourceimpl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
sourcefn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
. Read more
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Immutable access to the Borrow<B>
of a value. Read more
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the BorrowMut<B>
of a value. Read more
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Immutable access to the AsRef<R>
view of a value. Read more
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Mutable access to the AsMut<R>
view of a value. Read more
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the Deref::Target
of a value. Read more
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the Deref::Target
of a value. Read more
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls .tap()
only in debug builds, and is erased in release builds.
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
impl<F> TryExtractInto<F> for F
impl<F> TryExtractInto<F> for F
fn try_extract_into<T>(self) -> Result<T, TryExtractFromError> where
T: TryExtractFrom<F>,
fn try_extract_into<T>(self) -> Result<T, TryExtractFromError> where
T: TryExtractFrom<F>,
Extract value of the given type from any type (e.g. [‘Constant’], [super::value::Value
])
on which [TryExtractFrom
] is implemented Read more