pub struct Value(/* private fields */);
Implementations§
Source§impl Value
impl Value
Sourcepub fn to_cbor_bytes(&self) -> Vec<u8> ⓘ
pub fn to_cbor_bytes(&self) -> Vec<u8> ⓘ
- Serialize this type to CBOR bytes
- This type type supports encoding preservation so this will preserve round-trip CBOR formats.
- If created from scratch the CBOR will be canonical.
Sourcepub fn to_canonical_cbor_bytes(&self) -> Vec<u8> ⓘ
pub fn to_canonical_cbor_bytes(&self) -> Vec<u8> ⓘ
- Serialize this type to CBOR bytes using canonical CBOR encodings
Sourcepub fn from_cbor_bytes(cbor_bytes: &[u8]) -> Result<Value, JsError>
pub fn from_cbor_bytes(cbor_bytes: &[u8]) -> Result<Value, JsError>
- Create this type from CBOR bytes
Sourcepub fn to_cbor_hex(&self) -> String
pub fn to_cbor_hex(&self) -> String
- Serialize this type to CBOR bytes encoded as a hex string (useful for working with CIP30).
- This type type supports encoding preservation so this will preserve round-trip CBOR formats.
- If created from scratch the CBOR will be canonical.
Sourcepub fn to_canonical_cbor_hex(&self) -> String
pub fn to_canonical_cbor_hex(&self) -> String
- Serialize this type to CBOR bytes using canonical CBOR encodings as hex bytes
Source§impl Value
impl Value
pub fn from_coin(coin: Coin) -> Self
pub fn new(coin: Coin, multiasset: &MultiAsset) -> Self
pub fn coin(&self) -> Coin
pub fn multi_asset(&self) -> MultiAsset
pub fn zero() -> Value
pub fn is_zero(&self) -> bool
pub fn has_multiassets(&self) -> bool
pub fn checked_add(&self, rhs: &Value) -> Result<Value, JsError>
Sourcepub fn checked_sub(&self, rhs: &Value) -> Result<Value, JsError>
pub fn checked_sub(&self, rhs: &Value) -> Result<Value, JsError>
Subtract ADA and/or assets Removes an asset from the list if the result is 0 or less Does not modify this object, instead the result is returned None is returned if there would be integer underflow
pub fn clamped_sub(&self, rhs: &Value) -> Value
Trait Implementations§
Source§impl FromWasmAbi for Value
impl FromWasmAbi for Value
Source§impl IntoWasmAbi for Value
impl IntoWasmAbi for Value
Source§impl LongRefFromWasmAbi for Value
impl LongRefFromWasmAbi for Value
Source§impl OptionFromWasmAbi for Value
impl OptionFromWasmAbi for Value
Source§impl OptionIntoWasmAbi for Value
impl OptionIntoWasmAbi for Value
Source§impl RefFromWasmAbi for Value
impl RefFromWasmAbi for Value
Source§impl RefMutFromWasmAbi for Value
impl RefMutFromWasmAbi for Value
Source§impl TryFromJsValue for Value
impl TryFromJsValue for Value
Source§impl VectorFromWasmAbi for Value
impl VectorFromWasmAbi for Value
Source§impl VectorIntoWasmAbi for Value
impl VectorIntoWasmAbi for Value
impl SupportsConstructor for Value
impl SupportsInstanceProperty for Value
impl SupportsStaticProperty for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
Source§fn 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
.