mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +00:00
Remove unneeded Ord bound from All, Contains supports tuples (#8691)
* Remove unneeded `Ord` bound from All * Fixes * Contains supports tuples
This commit is contained in:
@@ -27,10 +27,20 @@ pub trait Contains<T> {
|
||||
|
||||
/// A `Contains` implementation which always returns `true`.
|
||||
pub struct All<T>(PhantomData<T>);
|
||||
impl<T: Ord> Contains<T> for All<T> {
|
||||
impl<T> Contains<T> for All<T> {
|
||||
fn contains(_: &T) -> bool { true }
|
||||
}
|
||||
|
||||
#[impl_trait_for_tuples::impl_for_tuples(30)]
|
||||
impl<T> Contains<T> for Tuple {
|
||||
fn contains(t: &T) -> bool {
|
||||
for_tuples!( #(
|
||||
if Tuple::contains(t) { return true }
|
||||
)* );
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a type which implements the `Contains` trait for a particular type with syntax similar
|
||||
/// to `matches!`.
|
||||
#[macro_export]
|
||||
|
||||
Reference in New Issue
Block a user