Type restriction


#1

Hi all,

Is there a way to restrict a generic type to a set of types ? I use the following trick:

pub trait Indexable {}
impl Indexable for usize {}
impl Indexable for Vec<usize> {}

and used a trait bound. Is it possible to say a type is ‘either this or either that’ specially in newer version of Rust ?

Thanks for your help.


#2

See:


#3

But will Junction types be implemented soon?