git.delta.rocks / unique-network / refs/commits / 25b9e9e7bf38

difftreelog

source

pallets/proxy-rmrk-core/src/misc.rs902 Bsourcehistory
1use super::*;2use codec::{Encode, Decode};34#[macro_export]5macro_rules! map_common_err_to_proxy {6    (match $err:ident { $($common_err:ident => $proxy_err:ident),+ }) => {7        $(8            if $err == <CommonError<T>>::$common_err.into() {9                return <Error<T>>::$proxy_err.into()10            } else11        )+ {12            $err13        }14    };15}1617pub trait RmrkDecode<T: Decode + Default, S> {18    fn decode_or_default(&self) -> T;19}2021impl<T: Decode + Default, S> RmrkDecode<T, S> for BoundedVec<u8, S> {22    fn decode_or_default(&self) -> T {23        let mut value = self.as_slice();2425        T::decode(&mut value).unwrap_or_default()26    }27}2829#[derive(Encode, Decode, PartialEq, Eq)]30pub enum CollectionType {31    Regular,32    Resource,33    Base,34}3536#[derive(Encode, Decode, PartialEq, Eq)]37pub enum NftType {38    Regular,39    Resource,40    FixedPart,41    SlotPart,42    Theme43}