Moving beyong tokio-util's Either

I've been getting surprisingly far with tokio-utils' Either, but recently realized I need three backend implementations in a project, and it may grow beyond that. I suspect Either can be nested, but assuming one doesn't want to do that, is there an already existing generic solution to handle N backends?

tokio::select! {}?

pub enum Either<L, R> {


pub enum Three<A, B, C> {
  A(A), B(B), C(C) }

Is this what you want? Though I think idiomatic Rust is to have a more descriptive enum (i.e. hardcode the A, B, C).

Nesting Either is fine.

1 Like