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.rsdiffbeforeafterboth--- a/pallets/proxy-rmrk-core/src/property.rs
+++ b/pallets/proxy-rmrk-core/src/property.rs
@@ -75,8 +75,12 @@
#[macro_export]
macro_rules! rmrk_property {
+ (Config=$cfg:ty, key: $key:ident $(($key_ext:expr))?) => {
+ rmrk_property!(Config=$cfg, $crate::RmrkProperty::$key $(($key_ext))?)
+ };
+
(Config=$cfg:ty, $key:ident $(($key_ext:expr))?: $value:expr) => {{
- let key = rmrk_property!(@$cfg, $key $(($key_ext))?)?;
+ let key = rmrk_property!(@$cfg, $crate::RmrkProperty::$key $(($key_ext))?)?;
let value = $value.into_property_value()
.map_err(<$crate::Error<$cfg>>::from)?;
@@ -87,12 +91,12 @@
})
}};
- (@$cfg:ty, $key:ident $(($key_ext:expr))?) => {
- $crate::RmrkProperty::$key $(($key_ext))?.to_key::<$cfg>()
+ (@$cfg:ty, $key_enum:expr) => {
+ $key_enum.to_key::<$cfg>()
};
- (Config=$cfg:ty, $key:ident $(($key_ext:expr))?) => {
- PropertyScope::Rmrk.apply(rmrk_property!(@$cfg, $key $(($key_ext))?)?)
+ (Config=$cfg:ty, $key_enum:expr) => {
+ PropertyScope::Rmrk.apply(rmrk_property!(@$cfg, $key_enum)?)
.map_err(|_| <$crate::Error<$cfg>>::RmrkPropertyKeyIsTooLong)
};
}