difftreelog
feat:make rmrk_property! use enum values
in: master
2 files changed
pallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth238238239 fn get_collection_type(collection_id: CollectionId) -> Result<CollectionType, DispatchError> {239 fn get_collection_type(collection_id: CollectionId) -> Result<CollectionType, DispatchError> {240 let collection_type: CollectionType = <PalletCommon<T>>::collection_properties(collection_id)240 let collection_type: CollectionType = <PalletCommon<T>>::collection_properties(collection_id)241 .get(&rmrk_property!(Config=T, CollectionType)?)241 .get(&rmrk_property!(Config=T, key: CollectionType)?)242 .ok_or(<Error<T>>::CollectionUnknown)?242 .ok_or(<Error<T>>::CollectionUnknown)?243 .try_into()243 .try_into()244 .map_err(<Error<T>>::from)?;244 .map_err(<Error<T>>::from)?;pallets/proxy-rmrk-core/src/property.rsdiffbeforeafterboth757576#[macro_export]76#[macro_export]77macro_rules! rmrk_property {77macro_rules! rmrk_property {78 (Config=$cfg:ty, key: $key:ident $(($key_ext:expr))?) => {79 rmrk_property!(Config=$cfg, $crate::RmrkProperty::$key $(($key_ext))?)80 };8178 (Config=$cfg:ty, $key:ident $(($key_ext:expr))?: $value:expr) => {{82 (Config=$cfg:ty, $key:ident $(($key_ext:expr))?: $value:expr) => {{79 let key = rmrk_property!(@$cfg, $key $(($key_ext))?)?;83 let key = rmrk_property!(@$cfg, $crate::RmrkProperty::$key $(($key_ext))?)?;808481 let value = $value.into_property_value()85 let value = $value.into_property_value()82 .map_err(<$crate::Error<$cfg>>::from)?;86 .map_err(<$crate::Error<$cfg>>::from)?;87 })91 })88 }};92 }};899390 (@$cfg:ty, $key:ident $(($key_ext:expr))?) => {94 (@$cfg:ty, $key_enum:expr) => {91 $crate::RmrkProperty::$key $(($key_ext))?.to_key::<$cfg>()95 $key_enum.to_key::<$cfg>()92 };96 };939794 (Config=$cfg:ty, $key:ident $(($key_ext:expr))?) => {98 (Config=$cfg:ty, $key_enum:expr) => {95 PropertyScope::Rmrk.apply(rmrk_property!(@$cfg, $key $(($key_ext))?)?)99 PropertyScope::Rmrk.apply(rmrk_property!(@$cfg, $key_enum)?)96 .map_err(|_| <$crate::Error<$cfg>>::RmrkPropertyKeyIsTooLong)100 .map_err(|_| <$crate::Error<$cfg>>::RmrkPropertyKeyIsTooLong)97 };101 };98}102}