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 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<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.
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 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 LongRefFromWasmAbi for PlutusMap
impl LongRefFromWasmAbi 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
Source§impl TryFromJsValue for PlutusMap
impl TryFromJsValue for PlutusMap
Source§impl VectorFromWasmAbi for PlutusMap
impl VectorFromWasmAbi for PlutusMap
Source§impl VectorIntoWasmAbi for PlutusMap
impl VectorIntoWasmAbi for PlutusMap
impl SupportsConstructor for PlutusMap
impl SupportsInstanceProperty for PlutusMap
impl SupportsStaticProperty for PlutusMap
Auto Trait Implementations§
impl Freeze for PlutusMap
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> 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
.