mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
drew.tupletimestamp - Add tuple macro for timestamps too, break macro out into support (#1372)
* Add tuple and dont mess up spacing * Update lib.rs * Add timestamp tuple macro : * Tabs * Add docs.
This commit is contained in:
@@ -42,6 +42,7 @@ use primitives::traits::{As, Zero, One, Convert};
|
||||
use codec::HasCompact;
|
||||
use runtime_support::{StorageValue, StorageMap};
|
||||
use runtime_support::dispatch::Result;
|
||||
use runtime_support::for_each_tuple;
|
||||
use system::ensure_signed;
|
||||
use rstd::ops::Mul;
|
||||
|
||||
@@ -51,17 +52,6 @@ pub trait OnSessionChange<T> {
|
||||
fn on_session_change(time_elapsed: T, should_reward: bool);
|
||||
}
|
||||
|
||||
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,)* }
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_session_change {
|
||||
() => (
|
||||
impl<T> OnSessionChange<T> for () {
|
||||
@@ -80,7 +70,6 @@ macro_rules! impl_session_change {
|
||||
|
||||
for_each_tuple!(impl_session_change);
|
||||
|
||||
|
||||
pub trait Trait: timestamp::Trait {
|
||||
type ConvertAccountIdToSessionKey: Convert<Self::AccountId, Self::SessionKey>;
|
||||
type OnSessionChange: OnSessionChange<Self::Moment>;
|
||||
|
||||
Reference in New Issue
Block a user