Struct cml_chain_wasm::plutus::utils::PlutusMap
source · pub struct PlutusMap(/* private fields */);
Implementations§
source§impl PlutusMap
impl PlutusMap
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 from_cbor_bytes(cbor_bytes: &[u8]) -> Result<PlutusMap, JsError>
pub fn from_cbor_bytes(cbor_bytes: &[u8]) -> Result<PlutusMap, 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.
source§impl PlutusMap
impl PlutusMap
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
sourcepub fn set(&mut self, key: &PlutusData, value: &PlutusData)
pub fn set(&mut self, key: &PlutusData, value: &PlutusData)
Replaces all datums of a given key, if any exist.
sourcepub fn get(&self, key: &PlutusData) -> Option<PlutusData>
pub fn get(&self, key: &PlutusData) -> Option<PlutusData>
Gets the plutus datum corresponding to a given key, if it exists. Note: In the case of duplicate keys this only returns the first datum. This is an extremely rare occurence on-chain but can happen.
sourcepub fn get_all(&self, key: &PlutusData) -> Option<PlutusDataList>
pub fn get_all(&self, key: &PlutusData) -> Option<PlutusDataList>
In the extremely unlikely situation there are duplicate keys, this gets all of a single key
pub fn keys(&self) -> PlutusDataList
Trait Implementations§
source§impl FromWasmAbi for PlutusMap
impl FromWasmAbi for PlutusMap
source§impl IntoWasmAbi for PlutusMap
impl IntoWasmAbi for PlutusMap
source§impl OptionFromWasmAbi for PlutusMap
impl OptionFromWasmAbi for PlutusMap
source§impl OptionIntoWasmAbi for PlutusMap
impl OptionIntoWasmAbi for PlutusMap
source§impl RefFromWasmAbi for PlutusMap
impl RefFromWasmAbi for PlutusMap
source§impl RefMutFromWasmAbi for PlutusMap
impl RefMutFromWasmAbi for PlutusMap
Auto Trait Implementations§
impl RefUnwindSafe for PlutusMap
impl Send for PlutusMap
impl Sync for PlutusMap
impl Unpin for PlutusMap
impl UnwindSafe for PlutusMap
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§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
.