Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions traits/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#![cfg_attr(not(feature = "std"), no_std)]

use codec::{Decode, Encode};
use sp_runtime::RuntimeDebug;
use impl_trait_for_tuples::impl_for_tuples;
use sp_runtime::{DispatchResult, RuntimeDebug};
use sp_std::{
cmp::{Eq, PartialEq},
prelude::Vec,
Expand Down Expand Up @@ -64,11 +65,23 @@ pub struct TimestampedValue<Value: Ord + PartialOrd, Moment> {
pub timestamp: Moment,
}

#[impl_trait_for_tuples::impl_for_tuples(30)]
#[impl_for_tuples(30)]
pub trait Happened<T> {
fn happened(t: &T);
}

pub trait Handler<T> {
fn handle(t: &T) -> DispatchResult;
}

#[impl_for_tuples(30)]
impl<T> Handler<T> for Tuple {
fn handle(t: &T) -> DispatchResult {
for_tuples!( #( Tuple::handle(t); )* );
Ok(())
}
}

pub trait Contains<T> {
fn contains(t: &T) -> bool;
}