git.delta.rocks / unique-network / refs/commits / 7faf112aedc7

difftreelog

fix rmrk_property macro

Daniel Shiposha2022-05-18parent: #4e0b740.patch.diff
in: master

2 files changed

modifiedpallets/rmrk-proxy/src/misc.rsdiffbeforeafterboth
1use super::*;1use super::*;
2use codec::{Encode, Decode};2use codec::{Encode, Decode};
3use frame_support::dispatch::Vec;
3use pallet_nonfungible::NonfungibleHandle;4use pallet_nonfungible::NonfungibleHandle;
45
5#[macro_export]6#[macro_export]
6macro_rules! rmrk_property {7macro_rules! rmrk_property {
7 ($key:ident, $value:expr) => {8 ($key:ident, $value:expr) => {
8 Property {9 Property {
9 key: rmrk_property!($key),10 key: rmrk_property!(@raw $key),
10 value: $value.into()11 value: $value.into()
11 }12 }
12 };13 };
1314
14 ($key:ident) => {15 (@raw $key:ident) => {
15 RmrkProperty::$key.to_key()16 RmrkProperty::$key.to_key()
16 };17 };
18
19 ($key:ident) => {
20 PropertyScope::Rmrk.apply(rmrk_property!(@raw $key)).unwrap()
21 };
17}22}
1823
19macro_rules! impl_rmrk_value {24macro_rules! impl_rmrk_value {
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
678 }678 }
679}679}
680680
681#[derive(Debug)]
681pub enum PropertiesError {682pub enum PropertiesError {
682 NoSpaceForProperty,683 NoSpaceForProperty,
683 PropertyLimitReached,684 PropertyLimitReached,
693}694}
694695
695impl PropertyScope {696impl PropertyScope {
696 fn apply(self, key: PropertyKey) -> Result<PropertyKey, PropertiesError> {697 pub fn apply(self, key: PropertyKey) -> Result<PropertyKey, PropertiesError> {
697 let scope_str: &[u8] = match self {698 let scope_str: &[u8] = match self {
698 Self::None => return Ok(key),699 Self::None => return Ok(key),
699 Self::Rmrk => b"rmrk",700 Self::Rmrk => b"rmrk",