git.delta.rocks / unique-network / refs/commits / 334927b2e0c4

difftreelog

refactorprimitives): purge defaultness from rmrk

Fahrrader2022-06-02parent: #c1189fc.patch.diff
in: master

1 file changed

modifiedprimitives/data-structs/src/rmrk.rsdiffbeforeafterboth
1use codec::{Decode, Encode, MaxEncodedLen};1use codec::{Decode, Encode, MaxEncodedLen};
2use scale_info::TypeInfo;2use scale_info::TypeInfo;
3
4use derivative::Derivative;
53
6#[cfg(feature = "std")]4#[cfg(feature = "std")]
7use serde::Serialize;5use serde::Serialize;
147 pub value: BoundedValue,145 pub value: BoundedValue,
148}146}
149147
150#[derive(Encode, Decode, Default, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]148#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]
151#[cfg_attr(feature = "std", derive(Serialize))]149#[cfg_attr(feature = "std", derive(Serialize))]
152#[cfg_attr(feature = "std", serde(bound = "BoundedString: AsRef<[u8]>"))]150#[cfg_attr(feature = "std", serde(bound = "BoundedString: AsRef<[u8]>"))]
153pub struct BasicResource<BoundedString> {151pub struct BasicResource<BoundedString> {
260 pub thumb: Option<BoundedString>,258 pub thumb: Option<BoundedString>,
261}259}
262260
263#[derive(Encode, Decode, Derivative, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]261#[derive(Encode, Decode, Eq, PartialEq, Clone, Debug, TypeInfo, MaxEncodedLen)]
264#[cfg_attr(feature = "std", derive(Serialize))]262#[cfg_attr(feature = "std", derive(Serialize))]
265#[cfg_attr(263#[cfg_attr(
266 feature = "std",264 feature = "std",
269 BoundedParts: AsRef<[PartId]>267 BoundedParts: AsRef<[PartId]>
270 "#)268 "#)
271)]269)]
272#[derivative(Default(bound = ""))]
273pub enum ResourceTypes<BoundedString: Default, BoundedParts> {270pub enum ResourceTypes<BoundedString, BoundedParts> {
274 #[derivative(Default)]
275 Basic(BasicResource<BoundedString>),271 Basic(BasicResource<BoundedString>),
276 Composable(ComposableResource<BoundedString, BoundedParts>),272 Composable(ComposableResource<BoundedString, BoundedParts>),
277 Slot(SlotResource<BoundedString>),273 Slot(SlotResource<BoundedString>),
286 BoundedParts: AsRef<[PartId]>282 BoundedParts: AsRef<[PartId]>
287 "#)283 "#)
288)]284)]
289pub struct ResourceInfo<BoundedString: Default, BoundedParts> {285pub struct ResourceInfo<BoundedString, BoundedParts> {
290 /// id is a 5-character string of reasonable uniqueness.286 /// id is a 5-character string of reasonable uniqueness.
291 /// The combination of base ID and resource id should be unique across the entire RMRK287 /// The combination of base ID and resource id should be unique across the entire RMRK
292 /// ecosystem which288 /// ecosystem which
337}333}
338334
339#[cfg_attr(feature = "std", derive(Serialize))]335#[cfg_attr(feature = "std", derive(Serialize))]
340#[derive(Encode, Decode, Debug, Derivative, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]336#[derive(Encode, Decode, Debug, TypeInfo, Clone, PartialEq, Eq, MaxEncodedLen)]
341#[cfg_attr(337#[cfg_attr(
342 feature = "std",338 feature = "std",
343 serde(bound = "BoundedCollectionList: AsRef<[CollectionId]>")339 serde(bound = "BoundedCollectionList: AsRef<[CollectionId]>")
344)]340)]
345#[derivative(Default(bound = ""))]
346pub enum EquippableList<BoundedCollectionList> {341pub enum EquippableList<BoundedCollectionList> {
347 All,342 All,
348
349 #[derivative(Default)]
350 Empty,343 Empty,
351
352 Custom(#[cfg_attr(feature = "std", serde(with = "serialize::vec"))] BoundedCollectionList),344 Custom(#[cfg_attr(feature = "std", serde(with = "serialize::vec"))] BoundedCollectionList),