mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +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:
@@ -14,6 +14,7 @@ runtime-io ={ package = "sr-io", path = "../../core/sr-io", default-features = f
|
||||
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
|
||||
sr-version = { path = "../../core/sr-version", default-features = false }
|
||||
support = { package = "srml-support", path = "../support", default-features = false }
|
||||
impl-trait-for-tuples = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.2"
|
||||
|
||||
@@ -112,7 +112,7 @@ use sr_primitives::{
|
||||
use primitives::storage::well_known_keys;
|
||||
use support::{
|
||||
storage, decl_module, decl_event, decl_storage, StorageDoubleMap, StorageValue, StorageMap,
|
||||
Parameter, for_each_tuple, traits::{Contains, Get}, decl_error,
|
||||
Parameter, traits::{Contains, Get}, decl_error,
|
||||
};
|
||||
use safe_mix::TripletMix;
|
||||
use codec::{Encode, Decode};
|
||||
@@ -126,29 +126,12 @@ use primitives::ChangesTrieConfiguration;
|
||||
pub mod offchain;
|
||||
|
||||
/// Handler for when a new account has been created.
|
||||
#[impl_trait_for_tuples::impl_for_tuples(30)]
|
||||
pub trait OnNewAccount<AccountId> {
|
||||
/// A new account `who` has been registered.
|
||||
fn on_new_account(who: &AccountId);
|
||||
}
|
||||
|
||||
macro_rules! impl_on_new_account {
|
||||
() => (
|
||||
impl<AccountId> OnNewAccount<AccountId> for () {
|
||||
fn on_new_account(_: &AccountId) {}
|
||||
}
|
||||
);
|
||||
|
||||
( $($t:ident)* ) => {
|
||||
impl<AccountId, $($t: OnNewAccount<AccountId>),*> OnNewAccount<AccountId> for ($($t,)*) {
|
||||
fn on_new_account(who: &AccountId) {
|
||||
$($t::on_new_account(who);)*
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for_each_tuple!(impl_on_new_account);
|
||||
|
||||
/// Determiner to say whether a given account is unused.
|
||||
pub trait IsDeadAccount<AccountId> {
|
||||
/// Is the given account dead?
|
||||
|
||||
Reference in New Issue
Block a user