mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 05:21:08 +00:00
Switch to new proc-macro crate for implementing traits for tuples (#3598)
* Switch to new proc-macro crate for implementing traits for tuples * Switch back to stable `Cargo.lock` format * Reduce tuple number to match rusts default implementation
This commit is contained in:
@@ -266,21 +266,6 @@ pub enum Void {}
|
||||
#[doc(hidden)]
|
||||
pub use serde::{Serialize, Deserialize};
|
||||
|
||||
/// Programatically create derivations for tuples of up to 19 elements. You provide a second macro
|
||||
/// which is called once per tuple size, along with a number of identifiers, one for each element
|
||||
/// of the tuple.
|
||||
#[macro_export]
|
||||
macro_rules! for_each_tuple {
|
||||
($m:ident) => {
|
||||
for_each_tuple! { @IMPL $m !! A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, }
|
||||
};
|
||||
(@IMPL $m:ident !!) => { $m! { } };
|
||||
(@IMPL $m:ident !! $h:ident, $($t:ident,)*) => {
|
||||
$m! { $h $($t)* }
|
||||
for_each_tuple! { @IMPL $m !! $($t,)* }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -24,8 +24,6 @@ use primitives::u32_trait::Value as U32;
|
||||
use crate::sr_primitives::traits::{MaybeSerializeDebug, SimpleArithmetic, Saturating};
|
||||
use crate::sr_primitives::ConsensusEngineId;
|
||||
|
||||
use super::for_each_tuple;
|
||||
|
||||
/// Anything that can have a `::len()` method.
|
||||
pub trait Len {
|
||||
/// Return the length of data type.
|
||||
@@ -63,29 +61,12 @@ impl<V: PartialEq, T: Get<V>> Contains<V> for T {
|
||||
}
|
||||
|
||||
/// The account with the given id was killed.
|
||||
#[impl_trait_for_tuples::impl_for_tuples(30)]
|
||||
pub trait OnFreeBalanceZero<AccountId> {
|
||||
/// The account was the given id was killed.
|
||||
fn on_free_balance_zero(who: &AccountId);
|
||||
}
|
||||
|
||||
macro_rules! impl_on_free_balance_zero {
|
||||
() => (
|
||||
impl<AccountId> OnFreeBalanceZero<AccountId> for () {
|
||||
fn on_free_balance_zero(_: &AccountId) {}
|
||||
}
|
||||
);
|
||||
|
||||
( $($t:ident)* ) => {
|
||||
impl<AccountId, $($t: OnFreeBalanceZero<AccountId>),*> OnFreeBalanceZero<AccountId> for ($($t,)*) {
|
||||
fn on_free_balance_zero(who: &AccountId) {
|
||||
$($t::on_free_balance_zero(who);)*
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for_each_tuple!(impl_on_free_balance_zero);
|
||||
|
||||
/// Trait for a hook to get called when some balance has been minted, causing dilution.
|
||||
pub trait OnDilution<Balance> {
|
||||
/// Some `portion` of the total balance just "grew" by `minted`. `portion` is the pre-growth
|
||||
|
||||
Reference in New Issue
Block a user