mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +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:
@@ -96,7 +96,7 @@ use codec::Encode;
|
||||
use codec::Decode;
|
||||
#[cfg(feature = "std")]
|
||||
use inherents::ProvideInherentData;
|
||||
use support::{StorageValue, Parameter, decl_storage, decl_module, for_each_tuple};
|
||||
use support::{StorageValue, Parameter, decl_storage, decl_module};
|
||||
use support::traits::{Time, Get};
|
||||
use sr_primitives::traits::{
|
||||
SimpleArithmetic, Zero, SaturatedConversion, Scale
|
||||
@@ -183,28 +183,11 @@ impl ProvideInherentData for InherentDataProvider {
|
||||
}
|
||||
|
||||
/// A trait which is called when the timestamp is set.
|
||||
#[impl_trait_for_tuples::impl_for_tuples(30)]
|
||||
pub trait OnTimestampSet<Moment> {
|
||||
fn on_timestamp_set(moment: Moment);
|
||||
}
|
||||
|
||||
macro_rules! impl_timestamp_set {
|
||||
() => (
|
||||
impl<Moment> OnTimestampSet<Moment> for () {
|
||||
fn on_timestamp_set(_: Moment) {}
|
||||
}
|
||||
);
|
||||
|
||||
( $($t:ident)* ) => {
|
||||
impl<Moment: Copy, $($t: OnTimestampSet<Moment>),*> OnTimestampSet<Moment> for ($($t,)*) {
|
||||
fn on_timestamp_set(moment: Moment) {
|
||||
$($t::on_timestamp_set(moment);)*
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for_each_tuple!(impl_timestamp_set);
|
||||
|
||||
/// The module configuration trait
|
||||
pub trait Trait: system::Trait {
|
||||
/// Type used for expressing timestamp.
|
||||
|
||||
Reference in New Issue
Block a user