pub struct PlutusMap {
pub entries: Vec<(PlutusData, PlutusData)>,
pub encoding: LenEncoding,
}
Fields§
§entries: Vec<(PlutusData, PlutusData)>
§encoding: LenEncoding
Implementations§
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<Vec<&PlutusData>>
pub fn get_all(&self, key: &PlutusData) -> Option<Vec<&PlutusData>>
In the extremely unlikely situation there are duplicate keys, this gets all of a single key
Trait Implementations§
Source§impl Deserialize for PlutusMap
impl Deserialize for PlutusMap
fn deserialize<R: BufRead + Seek>( raw: &mut Deserializer<R>, ) -> Result<Self, DeserializeError>
Source§fn from_cbor_bytes(data: &[u8]) -> Result<Self, DeserializeError>where
Self: Sized,
fn from_cbor_bytes(data: &[u8]) -> Result<Self, DeserializeError>where
Self: Sized,
from-bytes using the exact CBOR format specified in the CDDL binary spec.
For hashes/addresses/etc this will include the CBOR bytes type/len/etc.
Source§impl Ord for PlutusMap
impl Ord for PlutusMap
Source§impl PartialOrd for PlutusMap
impl PartialOrd for PlutusMap
Source§impl Serialize for PlutusMap
impl Serialize for PlutusMap
fn serialize<'se, W: Write>( &self, serializer: &'se mut Serializer<W>, force_canonical: bool, ) -> Result<&'se mut Serializer<W>>
Source§fn to_cbor_bytes(&self) -> Vec<u8> ⓘ
fn to_cbor_bytes(&self) -> Vec<u8> ⓘ
Bytes of a structure using the CBOR bytes as per the CDDL spec
which for foo = bytes will include the CBOR bytes type/len, etc.
This gives the original bytes in the case where this was created
from bytes originally, or will use whatever the specific encoding
details are present in any encoding details struct for the type.
impl Eq 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> FromBytes for Twhere
T: Deserialize,
impl<T> FromBytes for Twhere
T: Deserialize,
fn from_bytes(data: Vec<u8>) -> Result<T, DeserializeError>
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 more