race<B, F> method
Races this fiber with another, returning the first to complete
Implementation
Future<Either<Exit<A, E>, Exit<B, F>>> race<B, F>(Fiber<B, F> other) async {
final result = await Future.any([
_future.then((exit) => (0, exit)),
other._future.then((exit) => (1, exit)),
]);
return switch (result) {
(0, final Exit<Object?, Object?> exit) => Either.left(exit as Exit<A, E>),
(1, final Exit<Object?, Object?> exit) => Either.right(exit as Exit<B, F>),
_ => throw StateError('Unexpected race result'),
};
}