Reputation: 19
Suppose I have the following
pub struct A { type M : Eq + PartialOrd; }
How can I create something like
struct B { type N : Eq + PartialOrd + std::hash::Hash; }
Without necessarily referencing Eq + PartialOrd but instead reference directly M and write something like
type N = A::M + std::hash::Hash;
Upvotes: 0
Views: 40
Reputation: 42796
It is still unstable, but the way of doing this would be trait_alias
:
#![feature(trait_alias)]
trait At = Eq + PartialOrd;
trait Bt = At + std::hash::Hash;
Upvotes: 3