Purify Contains, add IsInVec, All and SortedMembers (#8589)

* IsInVec

* Purify `Contains`, introduce SortedMembers
This commit is contained in:
Gavin Wood
2021-04-11 00:04:02 +02:00
committed by GitHub
parent fe775ab954
commit 29864b255c
9 changed files with 60 additions and 15 deletions
+4 -1
View File
@@ -459,13 +459,16 @@ macro_rules! ord_parameter_types {
);
() => ();
(IMPL $name:ident , $type:ty , $value:expr) => {
impl $crate::traits::Contains<$type> for $name {
impl $crate::traits::SortedMembers<$type> for $name {
fn contains(t: &$type) -> bool { &$value == t }
fn sorted_members() -> $crate::sp_std::prelude::Vec<$type> { vec![$value] }
fn count() -> usize { 1 }
#[cfg(feature = "runtime-benchmarks")]
fn add(_: &$type) {}
}
impl $crate::traits::Contains<$type> for $name {
fn contains(t: &$type) -> bool { &$value == t }
}
}
}