pub enum PlutusData {
ConstrPlutusData(ConstrPlutusData),
Map(PlutusMap),
List {
list: Vec<PlutusData>,
list_encoding: LenEncoding,
},
Integer(BigInteger),
Bytes {
bytes: Vec<u8>,
bytes_encoding: StringEncoding,
},
}
Variants§
Implementations§
Source§impl PlutusData
impl PlutusData
Sourcepub fn to_cardano_node_format(&self) -> Self
pub fn to_cardano_node_format(&self) -> Self
Convert to a Datum that will serialize equivalent to cardano-node’s format
Please VERY STRONGLY consider using PlutusData::from_cbor_bytes() instead wherever possible. You should try to never rely on a tool encoding CBOR a certain way as there are many possible, and just because it matches with a specific datum, doesn’t mean that a different datum won’t differ. This is critical as that means the datum hash won’t match. After creation a datum (or other hashable CBOR object) should only be treated as raw CBOR bytes, or through a type that respects its specific CBOR format e.g. CML’s PlutusData::from_cbor_bytes()
This function is just here in case there’s no possible way at all to create from CBOR bytes and thus cold only be constructed manually and then had this function called on it.
This is also the format that CSL and Lucid use
Source§impl PlutusData
impl PlutusData
pub fn new_constr_plutus_data(constr_plutus_data: ConstrPlutusData) -> Self
pub fn new_map(map: PlutusMap) -> Self
pub fn new_list(list: Vec<PlutusData>) -> Self
pub fn new_integer(integer: BigInteger) -> Self
pub fn new_bytes(bytes: Vec<u8>) -> Self
pub fn hash(&self) -> DatumHash
Trait Implementations§
Source§impl Clone for PlutusData
impl Clone for PlutusData
Source§fn clone(&self) -> PlutusData
fn clone(&self) -> PlutusData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PlutusData
impl Debug for PlutusData
Source§impl<'de> Deserialize<'de> for PlutusData
impl<'de> Deserialize<'de> for PlutusData
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Deserialize for PlutusData
impl Deserialize for PlutusData
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,
Source§impl Hash for PlutusData
impl Hash for PlutusData
Source§impl JsonSchema for PlutusData
impl JsonSchema for PlutusData
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn json_schema(_gen: &mut SchemaGenerator) -> Schema
fn json_schema(_gen: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl Ord for PlutusData
impl Ord for PlutusData
Source§impl PartialEq for PlutusData
impl PartialEq for PlutusData
Source§impl PartialOrd for PlutusData
impl PartialOrd for PlutusData
Source§impl Serialize for PlutusData
impl Serialize for PlutusData
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> ⓘ
Source§impl Serialize for PlutusData
impl Serialize for PlutusData
impl Eq for PlutusData
Auto Trait Implementations§
impl Freeze for PlutusData
impl RefUnwindSafe for PlutusData
impl Send for PlutusData
impl Sync for PlutusData
impl Unpin for PlutusData
impl UnwindSafe for PlutusData
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
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>
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>
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