Type restriction

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.

See:

1 Like

But will Junction types be implemented soon?