Enum Ipld Copy item path Source pub enum Ipld {
Null,
Bool(bool ),
Integer(i128 ),
Float(f64 ),
String(String ),
Bytes(Vec <u8 >),
List(Vec <Ipld >),
Map(BTreeMap <String , Ipld >),
Link(Cid <64>),
}Expand description Construct an Ipld from a literal.
ⓘ let value = ipld! ({
"code" : 200 ,
"success" : true ,
"payload" : {
"features" : [
"serde" ,
"json"
]
}
});
Variables or expressions can be interpolated into the JSON literal. Any type
interpolated into an array element or object value must implement Serde’s
Serialize trait, while any type interpolated into a object key must
implement Into<String>. If the Serialize implementation of the
interpolated type decides to fail, or if the interpolated type contains a
map with non-string keys, the json! macro will panic.
ⓘ let code = 200 ;
let features = vec! ["serde" , "json" ];
let value = ipld! ({
"code" : code,
"success" : code == 200 ,
"payload" : {
features[0 ]: features[1 ]
}
});
Trailing commas are allowed inside both arrays and objects.
ⓘ let value = ipld! ([
"notice" ,
"the" ,
"trailing" ,
"comma -->" ,
]);
Ipld
Represents the absence of a value or the value undefined.
Represents a boolean value.
Represents a floating point value.
Represents an UTF-8 string.
Represents a sequence of bytes.
Represents a map of strings.
Represents a map of integers.
Destructs an ipld list or map
Indexes into an ipld list or map.
Returns the references to other blocks.
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From <T> for U chooses to do.
Scrape the references from an
impl Read.
Read more The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more Uses borrowed data to replace owned data, usually by cloning.
Read more The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.