mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
add Copy to Moment type (#3476)
* add Copy to Moment type * bump version * add Copy to support::Traits::Time::Moment and removed few clones
This commit is contained in:
committed by
Bastian Köcher
parent
672e62fe0f
commit
da03850eed
@@ -195,9 +195,9 @@ macro_rules! impl_timestamp_set {
|
||||
);
|
||||
|
||||
( $($t:ident)* ) => {
|
||||
impl<Moment: Clone, $($t: OnTimestampSet<Moment>),*> OnTimestampSet<Moment> for ($($t,)*) {
|
||||
impl<Moment: Copy, $($t: OnTimestampSet<Moment>),*> OnTimestampSet<Moment> for ($($t,)*) {
|
||||
fn on_timestamp_set(moment: Moment) {
|
||||
$($t::on_timestamp_set(moment.clone());)*
|
||||
$($t::on_timestamp_set(moment);)*
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ for_each_tuple!(impl_timestamp_set);
|
||||
pub trait Trait: system::Trait {
|
||||
/// Type used for expressing timestamp.
|
||||
type Moment: Parameter + Default + SimpleArithmetic
|
||||
+ Scale<Self::BlockNumber, Output = Self::Moment>;
|
||||
+ Scale<Self::BlockNumber, Output = Self::Moment> + Copy;
|
||||
|
||||
/// Something which can be notified when the timestamp is set. Set this to `()` if not needed.
|
||||
type OnTimestampSet: OnTimestampSet<Self::Moment>;
|
||||
@@ -246,7 +246,7 @@ decl_module! {
|
||||
Self::now().is_zero() || now >= Self::now() + T::MinimumPeriod::get(),
|
||||
"Timestamp must increment by at least <MinimumPeriod> between sequential blocks"
|
||||
);
|
||||
<Self as Store>::Now::put(now.clone());
|
||||
<Self as Store>::Now::put(now);
|
||||
<Self as Store>::DidUpdate::put(true);
|
||||
|
||||
<T::OnTimestampSet as OnTimestampSet<_>>::on_timestamp_set(now);
|
||||
|
||||
Reference in New Issue
Block a user