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> {
    Left(L),
    Right(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

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.